-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-lld-musl
44 lines (43 loc) · 3 KB
/
Dockerfile-lld-musl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM alpine:latest AS build
ENV RUSTFLAGS="-Copt-level=z -Clinker=rust-lld -Clink-arg=-L/usr/lib" \
RUST_BACKTRACE=full \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN apk add --no-cache libgcc clang pkgconf libc-dev openssl-dev zlib-dev libssh2-dev curl-dev && \
wget -qO- https://sh.rustup.rs > rustup-init.sh && \
chmod +x ./rustup-init.sh && \
./rustup-init.sh -y --verbose --no-modify-path --default-toolchain stable --profile minimal --component llvm-tools-preview && \
ln -sf /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so && \
ln -sf /usr/bin/clang /usr/bin/cc && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/rust-lld /usr/bin/ld && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/llvm-ar /usr/bin/ar && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/* /usr/lib/ && \
cargo install --color=always cargo-audit cargo-criterion cargo-expand cargo-geiger gitlab-report grcov wasm-bindgen-cli cargo-binutils
FROM alpine:latest
ARG ALLURE_VERSION="2.15.0"
ENV RUSTFLAGS="-Clinker=rust-lld -Clink-arg=-L/usr/lib" \
RUST_BACKTRACE=full \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:/allure/bin/:$PATH
COPY --from=build /usr/local/cargo/bin /usr/local/cargo/bin
RUN apk add --no-cache musl-dev libgcc openssl curl clang openjdk11-jre-headless && \
wget -qO- https://sh.rustup.rs > rustup-init.sh && \
chmod +x ./rustup-init.sh && \
./rustup-init.sh --verbose -y --no-modify-path --default-toolchain nightly --profile minimal --component clippy rust-src rustfmt llvm-tools-preview && \
rustup --verbose component remove rust-std && \
ln -sf /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so && \
ln -sf /usr/bin/clang /usr/bin/cc && \
ln -sf /usr/bin/clang /usr/bin/riscv64-linux-musl-gcc && \
ln -sf /usr/bin/clang /usr/bin/aarch64-linux-musl-gcc && \
ln -sf /usr/bin/clang /usr/bin/powerpc64le-linux-musl-gcc && \
ln -sf /usr/bin/clang /usr/bin/mips64-linux-musl-gcc && \
ln -sf /usr/bin/clang /usr/bin/x86_64-linux-gnu-gcc && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/rust-lld /usr/bin/ld && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/llvm-ar /usr/bin/ar && \
ln -sf /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/* /usr/lib/ && \
rm -rf /usr/local/rustup/toolchains/*-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld && \
rm -rf /usr/lib/jvm/java-11-openjdk/legal && \
wget -qO- https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/$ALLURE_VERSION/allure-commandline-$ALLURE_VERSION.tgz | tar -xz && \
mv allure-$ALLURE_VERSION /allure