File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,26 @@ ADD config.toml /usr/local/cargo/
24
24
RUN cargo install --root /cargo-cross
[email protected] [email protected]
25
25
26
26
27
- FROM rust:${RUST_VERSION}-alpine3.20
27
+ FROM rust:${RUST_VERSION}-alpine3.20 AS tools-target-base
28
28
ENV TARGETS="x86_64-unknown-linux-musl aarch64-unknown-linux-musl x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu riscv64gc-unknown-linux-gnu"
29
29
RUN rustup target add ${TARGETS}
30
30
31
31
# needed for cargo-chef and cargo-sbom, as well as many other compilations
32
- RUN apk add musl-dev linux-headers make clang mold
32
+ RUN apk add musl-dev linux-headers make clang mold python3
33
33
34
34
# copy the cargo plugins from the tools stage
35
35
COPY --from=tools /cargo-cross /usr/local/cargo
36
36
# we define target specific rustc flags for cross-compilation
37
37
ADD config.toml /usr/local/cargo/
38
+
39
+ FROM tools-target-base AS tools-target-amd64
40
+ ENV CARGO_BUILD_TARGET="x86_64-unknown-linux-musl"
41
+
42
+ FROM tools-target-base AS tools-target-arm64
43
+ ENV CARGO_BUILD_TARGET="aarch64-unknown-linux-musl"
44
+
45
+ FROM tools-target-base AS tools-target-riscv64
46
+ ENV CARGO_BUILD_TARGET="riscv64gc-unknown-linux-gnu"
47
+
48
+ FROM tools-target-$TARGETARCH AS tools-target
49
+ RUN echo "Cargo target: $CARGO_BUILD_TARGET"
You can’t perform that action at this time.
0 commit comments