File tree 1 file changed +19
-6
lines changed
1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change 1
1
# build openapi-codegen
2
- FROM rust:1.85 AS openapi-codegen-builder
3
- ARG RUST_TARGET="x86_64-unknown-linux-musl"
2
+ FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.85 AS chef
4
3
WORKDIR /app
5
- RUN rustup target add ${RUST_TARGET}
4
+
5
+ FROM chef AS planner
6
+
6
7
COPY Cargo.toml .
7
8
COPY Cargo.lock .
8
9
COPY src /app/src
9
- RUN cargo build --target ${RUST_TARGET} --release --bin openapi-codegen
10
+
11
+ RUN cargo chef prepare --recipe-path recipe.json
12
+
13
+ FROM chef AS openapi-codegen-builder
14
+
15
+ COPY --from=planner /app/recipe.json recipe.json
16
+
17
+ RUN cargo chef cook --release --recipe-path recipe.json
18
+
19
+ COPY Cargo.toml .
20
+ COPY Cargo.lock .
21
+ COPY src /app/src
22
+
23
+ RUN cargo build --release --bin openapi-codegen
10
24
11
25
# build rubyfmt
12
26
FROM docker.io/rust:1.85 AS rubyfmt-builder
@@ -49,7 +63,6 @@ RUN rm -rf /usr/local/go/*.md && \
49
63
50
64
# main image
51
65
FROM alpine:3.21
52
- ARG RUST_TARGET="x86_64-unknown-linux-musl"
53
66
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/root/.cargo/bin"
54
67
RUN apk add --no-cache openjdk17-jre-headless curl gcompat libgcc ruff libstdc++
55
68
@@ -115,4 +128,4 @@ RUN apk add --no-cache binutils && \
115
128
apk del binutils
116
129
117
130
# openapi-codegen
118
- COPY --from=openapi-codegen-builder /app/target/${RUST_TARGET}/ release/openapi-codegen /usr/bin/
131
+ COPY --from=openapi-codegen-builder /app/target/release/openapi-codegen /usr/bin/
You can’t perform that action at this time.
0 commit comments