File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
- FROM --platform=amd64 rust:1.72-alpine as builder
2
- WORKDIR /build
1
+ FROM --platform=amd64 rust:1.72-alpine as common-build
3
2
4
- # RUN apt-get update && apt-get install -y build-essential musl-dev musl-tools gcc-x86-64-linux-gnu && apt-get clean && rm -rf /var/lib/apt/lists/*
5
3
RUN apk update && apk upgrade && apk add --no-cache musl-dev
6
4
RUN rustup target add x86_64-unknown-linux-musl
5
+ RUN cargo install cargo-chef --locked
7
6
8
- ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
7
+ WORKDIR /build
8
+
9
+ FROM common-build AS planner
9
10
10
- COPY Cargo.toml Cargo.lock ./
11
- RUN mkdir -p src && touch src/main.rs
12
- RUN cargo fetch --target x86_64-unknown-linux-musl --locked
11
+ COPY . ./
12
+ RUN cargo chef prepare --recipe-path recipe.json
13
+
14
+ FROM common-build AS builder
15
+
16
+ COPY --from=planner /build/recipe.json recipe.json
17
+ RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
13
18
14
19
COPY . ./
15
- RUN cargo build --target x86_64-unknown-linux-musl --release --locked
20
+ ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
21
+ RUN cargo build --release --locked --target x86_64-unknown-linux-musl --bin valfisk
16
22
17
23
FROM gcr.io/distroless/static:latest
18
24
COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/valfisk /valfisk
You can’t perform that action at this time.
0 commit comments