From 75c7e11f55be2b6aed98907a7dcf98d1fb5cced6 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Thu, 7 May 2026 21:12:41 +0800 Subject: [PATCH] fix(docker): touch source files to force cargo recompilation Docker COPY preserves original file timestamps, which can be older than the dummy-source binary compiled in the dependency caching layer. Cargo sees the sources as unchanged and skips recompilation, producing a 329KB empty binary instead of the real web server. --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index a1ac23850..bc22be4dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,11 @@ RUN case "$TARGETARCH" in \ COPY crates/ crates/ COPY src-web/ src-web/ +# Docker COPY preserves original file timestamps, which may be older than the +# dummy-source binary compiled above. Touch all .rs files so cargo detects the +# source change and recompiles instead of reusing the dummy binary. +RUN find crates/ src-web/ -name '*.rs' -exec touch {} + + RUN case "$TARGETARCH" in \ amd64) rust_target=x86_64-unknown-linux-gnu; lib_arch=x86_64-linux-gnu ;; \ arm64) rust_target=aarch64-unknown-linux-gnu; lib_arch=aarch64-linux-gnu ;; \