Skip to content

Commit 7d65fc0

Browse files
committed
Set default build target for native builds
Signed-off-by: Mikhail Malyshev <[email protected]>
1 parent e3bbfee commit 7d65fc0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Dockerfile

+16-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ADD config.toml /usr/local/cargo/
2424
RUN cargo install --root /cargo-cross [email protected] [email protected]
2525

2626

27-
FROM rust:${RUST_VERSION}-alpine3.20
27+
FROM rust:${RUST_VERSION}-alpine3.20 AS tools-target
2828
ENV TARGETS="x86_64-unknown-linux-musl aarch64-unknown-linux-musl x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu riscv64gc-unknown-linux-gnu"
2929
RUN rustup target add ${TARGETS}
3030

@@ -35,3 +35,18 @@ RUN apk add musl-dev linux-headers make clang mold
3535
COPY --from=tools /cargo-cross /usr/local/cargo
3636
# we define target specific rustc flags for cross-compilation
3737
ADD config.toml /usr/local/cargo/
38+
39+
FROM tools-target AS tools-target-amd64
40+
# RUN rustup default $RUST_VERSION-x86_64-unknown-linux-gnu
41+
ENV CARGO_BUILD_TARGET="x86_64-unknown-linux-musl"
42+
43+
FROM tools-target AS tools-target-arm64
44+
# RUN rustup default $RUST_VERSION-aarch64-unknown-linux-gnu
45+
ENV CARGO_BUILD_TARGET="aarch64-unknown-linux-musl"
46+
47+
FROM tools-target AS tools-target-riscv64
48+
RUN rustup default $RUST_VERSION-riscv64gc-unknown-linux-gnu
49+
ENV CARGO_BUILD_TARGET="riscv64gc-unknown-linux-gnu"
50+
51+
FROM tools-target-$TARGETARCH AS tools-trget
52+
RUN echo "Cargo target: $CARGO_BUILD_TARGET"

0 commit comments

Comments
 (0)