From d577a5ba6f8eb9f62b11b8db79fd2f933f377984 Mon Sep 17 00:00:00 2001 From: ackintosh Date: Thu, 8 Dec 2022 22:17:40 +0900 Subject: [PATCH] Dockerfile: Specify files to be copied to avoid unnecessary compiling --- Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 422383a..16cd670 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,12 @@ RUN echo "fn main() { println!(\"If you see this message, you may want to clean COPY ./plan/Cargo.* ./plan/ RUN cd ./plan/ && cargo build -COPY . . +# Coping each files only needed instead of doing `COPY . .` (all of them) in order to avoid unnecessary compiling. +# (e.g. because of modifiying `manifest.toml`.) +# NOTE: `.dockerignore` is not effective because the build context is not this directory on the test run. +# See https://docs.testground.ai/builder-library/docker-generic#usage +COPY ./plan/src ./plan/src +COPY ./plan/examples ./plan/examples # This is in order to make sure `main.rs`s mtime timestamp is updated to avoid the dummy `main` # remaining in the release binary.