diff --git a/backend/Dockerfile.test-rust b/backend/Dockerfile.test-rust index b01ecc7..f17da91 100644 --- a/backend/Dockerfile.test-rust +++ b/backend/Dockerfile.test-rust @@ -21,12 +21,21 @@ RUN cargo chef cook --release --recipe-path recipe.json FROM base AS test-build COPY --from=deps /usr/local/cargo /usr/local/cargo COPY --from=deps /usr/local/rustup /usr/local/rustup -COPY --from=deps /app/target /app/target +# Copy only release artifacts to save space +COPY --from=deps /app/target/release /app/target/release COPY . . +# Clean up incremental compilation artifacts before test build +RUN rm -rf /app/target/debug/incremental RUN cargo test --workspace --locked --no-run +# Clean up after test build to save space +RUN rm -rf /app/target/debug/incremental /app/target/debug/build /app/target/debug/deps # Runner: minimal runtime for test execution FROM base AS runner -COPY --from=test-build /app /app +# Copy only necessary artifacts for test execution +COPY --from=test-build /app/target /app/target +COPY --from=test-build /app/Cargo.toml /app/Cargo.toml +COPY --from=test-build /app/Cargo.lock /app/Cargo.lock +COPY --from=test-build /app/crates /app/crates WORKDIR /app CMD ["cargo", "test", "--workspace", "--locked", "--", "--test-threads=1"] \ No newline at end of file