Skip to content

Commit 3a5ac1c

Browse files
committed
docker: build empty project with Cargo.toml and Cargo.lock for cache
1 parent d80fb5b commit 3a5ac1c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ ENV TINI_VERSION v0.19.0
77
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini-static
88
RUN sudo chmod +x /tini-static
99

10+
# Copy to Cargo setting and change the owner
11+
COPY --chown=rust:rust Cargo.toml Cargo.lock ./
12+
# Build empty project for better cache
13+
RUN mkdir src && \
14+
echo "fn main() {}" > src/main.rs && \
15+
cargo build --release && rm -r src
16+
1017
# Copy to current directory and change the owner
1118
COPY --chown=rust:rust . ./
1219
# Build

0 commit comments

Comments
 (0)