Skip to content

Commit

Permalink
Use RUN --mount=type=bind instead of COPY
Browse files Browse the repository at this point in the history
  • Loading branch information
hexium310 committed Nov 19, 2024
1 parent c5df7ae commit 10227ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ RUN --mount=type=cache,id=api:/var/cache/apt,target=/var/cache/apt \
FROM runtime AS development

FROM runtime AS builder
COPY . .
RUN --mount=type=cache,id=api:/usr/local/cargo/registry,target=/usr/local/cargo/registry \
RUN --mount=type=bind,source=crates,target=crates \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,id=api:/usr/local/cargo/registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=api:/usr/src/target,target=/usr/src/target \
cargo build --release --no-default-features --features=vendored,server \
&& cp target/release/kanatrans /usr/local/bin/kanatrans
Expand Down

0 comments on commit 10227ea

Please sign in to comment.