Skip to content

Commit e878ec5

Browse files
authored
Merge pull request #3961 from element-hq/quenting/remove-cargo-chef
Stop using cargo-chef in the docker build
2 parents f0e14ee + d102211 commit e878ec5

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

Dockerfile

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ ARG RUSTC_VERSION=1.84.0
1212
ARG NODEJS_VERSION=20.15.0
1313
ARG OPA_VERSION=0.64.1
1414
ARG CARGO_AUDITABLE_VERSION=0.6.6
15-
ARG CARGO_CHEF_VERSION=0.1.68
1615

1716
##########################################
1817
## Build stage that builds the frontend ##
@@ -56,23 +55,18 @@ RUN --network=none \
5655
make -B && \
5756
chmod a+r ./policy.wasm
5857

59-
##########################################################################
60-
## Base image with cargo-chef and the right cross-compilation toolchain ##
61-
##########################################################################
62-
FROM --platform=${BUILDPLATFORM} docker.io/library/rust:${RUSTC_VERSION}-${DEBIAN_VERSION_NAME} AS toolchain
58+
########################################
59+
## Build stage that builds the binary ##
60+
########################################
61+
FROM --platform=${BUILDPLATFORM} docker.io/library/rust:${RUSTC_VERSION}-${DEBIAN_VERSION_NAME} AS builder
6362

6463
ARG CARGO_AUDITABLE_VERSION
65-
ARG CARGO_CHEF_VERSION
6664
ARG RUSTC_VERSION
6765

68-
# Make cargo use the git cli for fetching dependencies
69-
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
70-
71-
# Install pinned versions of cargo-chef and cargo-auditable
66+
# Install pinned versions of cargo-auditable
7267
# Network access: to fetch dependencies
7368
RUN --network=default \
7469
cargo install --locked \
75-
cargo-chef@=${CARGO_CHEF_VERSION} \
7670
cargo-auditable@=${CARGO_AUDITABLE_VERSION}
7771

7872
# Install all cross-compilation targets
@@ -111,35 +105,7 @@ ENV \
111105
# Set the working directory
112106
WORKDIR /app
113107

114-
#####################################
115-
## Run the planner from cargo-chef ##
116-
#####################################
117-
FROM --platform=${BUILDPLATFORM} toolchain AS planner
118-
COPY ./Cargo.toml ./Cargo.lock /app/
119-
COPY ./crates /app/crates
120-
RUN --network=none \
121-
cargo chef prepare --recipe-path recipe.json --bin crates/cli
122-
123-
########################
124-
## Actual build stage ##
125-
########################
126-
FROM --platform=${BUILDPLATFORM} toolchain AS builder
127-
128-
# Build dependencies
129-
COPY --from=planner /app/recipe.json recipe.json
130-
# Network access: cargo-chef cook fetches the dependencies
131-
RUN --network=default \
132-
cargo chef cook \
133-
--bin mas-cli \
134-
--release \
135-
--recipe-path recipe.json \
136-
--no-default-features \
137-
--features docker \
138-
--target x86_64-unknown-linux-gnu \
139-
--target aarch64-unknown-linux-gnu \
140-
--package mas-cli
141-
142-
# Build the rest
108+
# Copy the code
143109
COPY ./ /app
144110
ENV SQLX_OFFLINE=true
145111

0 commit comments

Comments
 (0)