bin-select on cargo chef
This commit is contained in:
parent
9365abc7f8
commit
c483764b4b
1 changed files with 5 additions and 7 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,5 +1,6 @@
|
||||||
# Step -1: Grab mold
|
# Step -1: Grab mold
|
||||||
FROM lukemathwalker/cargo-chef as rust-base
|
FROM lukemathwalker/cargo-chef as rust-base
|
||||||
|
WORKDIR /app
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends curl clang
|
RUN apt-get update && apt-get install -y --no-install-recommends curl clang
|
||||||
ARG MOLD_VERSION=1.7.1
|
ARG MOLD_VERSION=1.7.1
|
||||||
RUN curl -sSL https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-x86_64-linux.tar.gz | tar xzv && \
|
RUN curl -sSL https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-x86_64-linux.tar.gz | tar xzv && \
|
||||||
|
@ -10,21 +11,18 @@ ENV RUSTFLAGS="-C link-arg=-fuse-ld=/mold"
|
||||||
|
|
||||||
# Step 1: Compute a recipe file
|
# Step 1: Compute a recipe file
|
||||||
FROM rust-base as planner
|
FROM rust-base as planner
|
||||||
WORKDIR /app
|
ARG SERVICE
|
||||||
RUN cargo install cargo-chef
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
RUN cargo chef prepare --recipe-path recipe.json --bin ${SERVICE}
|
||||||
|
|
||||||
# Step 2: Cache project dependencies
|
# Step 2: Cache project dependencies
|
||||||
FROM rust-base as cacher
|
FROM rust-base as cacher
|
||||||
WORKDIR /app
|
ARG SERVICE
|
||||||
RUN cargo install cargo-chef
|
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
RUN cargo chef cook --release --recipe-path recipe.json --bin ${SERVICE}
|
||||||
|
|
||||||
# Step 3: Build the binary
|
# Step 3: Build the binary
|
||||||
FROM rust-base as builder
|
FROM rust-base as builder
|
||||||
WORKDIR /app
|
|
||||||
COPY . .
|
COPY . .
|
||||||
# Copy over the cached dependencies from above
|
# Copy over the cached dependencies from above
|
||||||
COPY --from=cacher /app/target target
|
COPY --from=cacher /app/target target
|
||||||
|
|
Loading…
Add table
Reference in a new issue