From 60ac72d41f4de94c6a86dab7201669483ea9e191 Mon Sep 17 00:00:00 2001 From: Christbru Date: Sat, 18 Oct 2025 19:39:05 -0500 Subject: [PATCH] Only delete the main if it is the dummy file for dependency caching --- rust-engine/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust-engine/Dockerfile b/rust-engine/Dockerfile index 0595ee6..8e39de3 100644 --- a/rust-engine/Dockerfile +++ b/rust-engine/Dockerfile @@ -34,9 +34,11 @@ RUN mkdir -p src && echo "fn main() { println!(\"cargo cache build\"); }" > src/ # Fetch and build dependencies (this will be cached until Cargo.toml changes) RUN cargo build --release || true + # Now copy the real source and build the final binary COPY src ./src -RUN rm -f src/main.rs || true +# Only remove the dummy main.rs if it exists and is not the real one +RUN if grep -q 'cargo cache build' src/main.rs 2>/dev/null; then rm src/main.rs; fi RUN cargo build --release # --- Stage 2: Final, small image ---