Skip to content

Commit

Permalink
docker: build empty project with Cargo.toml and Cargo.lock for cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Nov 23, 2021
1 parent d80fb5b commit 3a5ac1c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini-static
RUN sudo chmod +x /tini-static

# Copy to Cargo setting and change the owner
COPY --chown=rust:rust Cargo.toml Cargo.lock ./
# Build empty project for better cache
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release && rm -r src

# Copy to current directory and change the owner
COPY --chown=rust:rust . ./
# Build
Expand Down

0 comments on commit 3a5ac1c

Please sign in to comment.