👷 drone
This commit is contained in:
parent
dcb97175d2
commit
224afb3547
1 changed files with 39 additions and 7 deletions
46
Dockerfile
46
Dockerfile
|
@ -1,15 +1,47 @@
|
|||
FROM rust:buster as builder
|
||||
####################################################################################################
|
||||
## 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}"
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN cargo build --release
|
||||
COPY ./ .
|
||||
|
||||
FROM debian
|
||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||
|
||||
COPY --from=builder /app/target/release/me-site /bin/me-site
|
||||
####################################################################################################
|
||||
## Final image
|
||||
####################################################################################################
|
||||
FROM alpine
|
||||
|
||||
VOLUME /config
|
||||
# Import from builder.
|
||||
COPY --from=builder /etc/passwd /etc/passwd
|
||||
COPY --from=builder /etc/group /etc/group
|
||||
|
||||
CMD [ "./bin/me-site" ]
|
||||
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
|
||||
|
||||
CMD ["/me-site"]
|
||||
|
|
Loading…
Add table
Reference in a new issue