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.
This commit is contained in:
t8y2 2026-05-07 21:12:41 +08:00
parent 198ac54355
commit 75c7e11f55
1 changed files with 5 additions and 0 deletions

View File

@ -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 ;; \