👷 drone
This commit is contained in:
parent
224afb3547
commit
b06a8a79c9
1 changed files with 1 additions and 37 deletions
38
Dockerfile
38
Dockerfile
|
@ -1,47 +1,11 @@
|
||||||
####################################################################################################
|
|
||||||
## Builder
|
|
||||||
####################################################################################################
|
|
||||||
FROM rust:latest AS 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
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./ .
|
COPY ./ .
|
||||||
|
|
||||||
RUN cargo build --target x86_64-unknown-linux-musl --release
|
RUN cargo build --target x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
####################################################################################################
|
COPY /app/target/release/me-site /me-site
|
||||||
## 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
|
|
||||||
|
|
||||||
CMD ["/me-site"]
|
CMD ["/me-site"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue