👷 drone

This commit is contained in:
JMARyA 2022-11-12 01:11:07 +01:00
parent 224afb3547
commit b06a8a79c9
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263

View file

@ -1,47 +1,11 @@
####################################################################################################
## 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
RUN update-ca-certificates
# Create appuser
ENV USER=actix
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
WORKDIR /app
COPY ./ .
RUN cargo build --target x86_64-unknown-linux-musl --release
####################################################################################################
## Final image
####################################################################################################
FROM alpine
# Import from builder.
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
WORKDIR /app
# Copy our build
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/me-site ./
# Use an unprivileged user.
USER actix:actix
COPY /app/target/release/me-site /me-site
CMD ["/me-site"]