forked from nicolasbauw/world-time-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
22 lines (20 loc) · 764 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM ekidd/rust-musl-builder:nightly-2020-07-12 AS builder
RUN sudo apt update && sudo apt install -y upx
ENV ROCKET_ENV=production
ADD . ./
RUN sudo chown -R rust:rust /home/rust
RUN cargo build --release
# Size optimization
RUN strip /home/rust/src/target/x86_64-unknown-linux-musl/release/world-time-api
RUN upx -9 /home/rust/src/target/x86_64-unknown-linux-musl/release/world-time-api
FROM alpine:latest
RUN apk update && apk add --no-cache tzdata
WORKDIR /usr/local/share/world-time-api
COPY --from=builder \
/home/rust/src/target/x86_64-unknown-linux-musl/release/world-time-api \
.
ENV ROCKET_ENV=production \
ROCKET_LOG=off
RUN adduser -D -u 1001 runner; chown -R 1001 /usr/local/share/world-time-api
USER 1001
ENTRYPOINT ["./world-time-api"]