Skip to content

Commit 490a201

Browse files
committed
remove cargo-chef and link to libgcc on aarch64.
1 parent 93d22c6 commit 490a201

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

Dockerfile

+5-21
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Rust syntax target, either x86_64-unknown-linux-musl, aarch64-unknown-linux-musl etc.
2-
ARG RUST_TARGET="aarch64-unknown-linux-musl"
2+
ARG RUST_TARGET="x86_64-unknown-linux-musl"
33
# The crate features to build this with
44
ARG FEATURES=""
55

6-
FROM --platform=$BUILDPLATFORM rustlang/rust:nightly AS chef
6+
FROM --platform=$BUILDPLATFORM rustlang/rust:nightly AS builder
77
ARG RUST_TARGET
88
ARG FEATURES
99

1010
RUN <<EOT
1111
set -ex
1212
apt-get update
1313
apt-get upgrade
14-
apt-get install --assume-yes musl-dev clang lld
14+
apt-get install --assume-yes musl-dev clang lld libgcc-12-dev-arm64-cross
1515
EOT
1616

1717
RUN <<-EOT bash
@@ -20,8 +20,6 @@ RUN <<-EOT bash
2020
rustup component add rust-src --toolchain "nightly"
2121
EOT
2222

23-
RUN cargo install cargo-chef --locked
24-
2523
COPY <<EOF /app/.cargo/config.toml
2624
[env]
2725
CC_aarch64-unknown-linux-musl = "clang -target aarch64-unknown-linux-musl -fuse-ld=lld"
@@ -34,6 +32,8 @@ linker = "clang"
3432
rustflags = [
3533
"-C", "link-args=-target aarch64-unknown-linux-musl -fuse-ld=lld",
3634
"-C", "strip=symbols",
35+
# aarch64 has to link libgcc
36+
"-C", "link-arg=-lgcc",
3737
]
3838

3939
[target.x86_64-unknown-linux-musl]
@@ -49,21 +49,6 @@ EOF
4949

5050
WORKDIR /app
5151

52-
FROM chef AS planner
53-
COPY . .
54-
RUN cargo chef prepare --recipe-path recipe.json
55-
56-
FROM chef AS builder
57-
COPY --from=planner /app/recipe.json recipe.json
58-
RUN <<-EOF bash
59-
set -ex
60-
if test "$FEATURES" = ""; then
61-
cargo chef cook --target "$RUST_TARGET" --release --recipe-path recipe.json
62-
else
63-
cargo chef cook --target "$RUST_TARGET" --features="$FEATURES" --release --recipe-path recipe.json
64-
fi
65-
EOF
66-
6752
COPY . .
6853

6954
RUN <<-EOF bash
@@ -76,7 +61,6 @@ RUN <<-EOF bash
7661
cp target/$RUST_TARGET/release/twilight-http-proxy /twilight-http-proxy
7762
EOF
7863

79-
8064
FROM scratch
8165

8266
COPY --from=builder /twilight-http-proxy /twilight-http-proxy

0 commit comments

Comments
 (0)