You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build a docker container for my application. For this I read that static linking with target x86_64-unknown-linux-musl could result in a better performance.
So I built this dockerfile:
###################################################################################################### Builder####################################################################################################FROM rust:latest AS builder
RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev libssl-dev pkg-config build-essential checkinstall zlib1g-dev
RUN update-ca-certificates
RUN mkdir /musl
RUN wget https://github.com/openssl/openssl/releases/download/openssl-3.3.1/openssl-3.3.1.tar.gz
RUN tar xfvz openssl-3.3.1.tar.gz
WORKDIR /openssl-3.3.1/
RUN ./config --prefix=/musl --openssldir=/musl/ssl shared zlib
RUN make test
RUN make
RUN make install
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV OPENSSL_STATIC=true
ENV OPENSSL_DIR=/musl
# Create appuserENV USER=ember
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"WORKDIR /ember-backend
COPY ./ .
RUN cargo build --target x86_64-unknown-linux-musl --release
###################################################################################################### Final image####################################################################################################FROM scratch
# Import from builder.COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
WORKDIR /ember-backend
# Copy our buildCOPY --from=builder /ember-backend/target/x86_64-unknown-linux-musl/release/ember-backend ./
# Use an unprivileged user.USER ember:ember
CMD ["/ember-backend/ember-backend"]
Hi,
I'm trying to build a docker container for my application. For this I read that static linking with target x86_64-unknown-linux-musl could result in a better performance.
So I built this dockerfile:
But sadly the build fails with:
Build log
I believe I did something wrong. Sadly I found no documentation about this.
Thanks for your help
The text was updated successfully, but these errors were encountered: