From 3dff9a247352390ba68287d9a6096d2986e5bd16 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Tue, 4 Aug 2026 00:55:35 +0800 Subject: [PATCH] fix docker build: compile real sources, lf entrypoint --- .gitattributes | 2 ++ Dockerfile | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9915b8a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Shell scripts must stay LF: CRLF breaks the shebang inside containers. +*.sh text eol=lf diff --git a/Dockerfile b/Dockerfile index ef55746..ae5c544 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,9 +29,14 @@ RUN wget -q -O /tmp/ffmpeg.tar.xz "$FFMPEG_URL" \ && rm /tmp/ffmpeg.tar.xz \ && /usr/local/bin/ffmpeg -version >/dev/null -# 3. Real sources last: only our crates recompile on source changes. +# 3. Real sources last: only our crates recompile on source changes. The +# COPY preserves host mtimes, which predate the stub artifacts from step 1; +# cargo's mtime-based freshness check would otherwise treat the stub build +# as up-to-date and never compile the real sources. `touch` forces cargo to +# see the real files as newer. COPY crates/ ./crates/ -RUN cargo build --release -p xmedia-bot +RUN find crates -type f -name '*.rs' -exec touch {} + \ + && cargo build --release -p xmedia-bot # ---------- runtime stage ---------- FROM debian:bookworm-slim