-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.arm64
32 lines (26 loc) · 1.17 KB
/
Dockerfile.arm64
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
# Build Stage
FROM rust:latest AS builder
ENV CC_aarch64_unknown_linux_musl=clang
ENV AR_aarch64_unknown_linux_musl=llvm-ar
# The below commented line works, need to test if the ones under it also work
# https://github.com/briansmith/ring/issues/1414#issuecomment-1596300080
# ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"
# ENV CFLAGS_aarch64_unknown_linux_musl="-nostdinc -nostdlib -isystem/usr/include/x86_64-linux-musl/"
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld -Clink-args=-L/usr/lib/x86_64-linux-musl/"
WORKDIR /usr/src/
RUN rustup target add aarch64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev clang llvm
RUN update-ca-certificates
RUN USER=root cargo new logger
WORKDIR /usr/src/logger
COPY ./logger/Cargo.toml ./Cargo.lock ./
RUN echo "openssl = { version = \"0.10\", features = [\"vendored\"] }" >> ./Cargo.toml
COPY ./api ../api
RUN cargo build --release
COPY ./logger/src ./src
RUN cargo install --target aarch64-unknown-linux-musl --path .
# Bundle Stage
FROM scratch
COPY --from=builder /usr/local/cargo/bin/logger .
USER 1000
CMD ["./logger"]