forked from bolcom/unFTP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalpine.Dockerfile.template
More file actions
26 lines (22 loc) · 947 Bytes
/
alpine.Dockerfile.template
File metadata and controls
26 lines (22 loc) · 947 Bytes
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
FROM rust:%%RUST_VERSION%%-slim AS builder
WORKDIR /usr/src/unftp
COPY . .
RUN apt-get update && apt-get install -y \
musl-dev \
musl-tools
RUN rustup target add x86_64-unknown-linux-musl
ENV RUSTFLAGS="-C target-feature=+crt-static"
RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker --release --target=x86_64-unknown-linux-musl
FROM alpine:latest
# we could also RUN 'apk add ca-certificates', but we prefer to be consistent with the -minimal image
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
# run as user for security
RUN mkdir /unftp && mkdir -p /srv
RUN addgroup -g 1010 unftp \
&& adduser -D -s /bin/sh -u 1010 -G unftp unftp \
&& chown -R unftp:unftp /unftp /srv
COPY --chown=unftp:unftp --from=builder /usr/src/unftp/target/x86_64-unknown-linux-musl/release/unftp /unftp
VOLUME /srv
WORKDIR /unftp
USER unftp
CMD ["/unftp/unftp", "-vv"]