This repository has been archived by the owner on Nov 8, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile
64 lines (48 loc) · 1.74 KB
/
Dockerfile
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
####################################################################################################
## Build phaser
####################################################################################################
FROM rust:latest AS builder_rust
RUN rustup update
RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev libssl-dev
RUN update-ca-certificates
# Create appuser
ENV USER=phaser
ENV UID=10001
# See https://stackoverflow.com/a/55757473/12429735RUN
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
WORKDIR /phaser
COPY ./ .
WORKDIR /phaser/phaser
RUN make build_static
# RUN make build
####################################################################################################
## Final image
####################################################################################################
# FROM scratch
# Here we prefer alpine because otherwise the container won't launch on heroku
FROM alpine:latest
RUN apk update && apk add --no-cache ca-certificates
RUN update-ca-certificates
# Import from builder.
COPY --from=builder_rust /etc/passwd /etc/passwd
COPY --from=builder_rust /etc/group /etc/group
WORKDIR /phaser
ENV PATH="/phaser:${PATH}"
# Copy our builds
COPY --from=builder_rust /phaser/phaser/dist/ ./
# Use an unprivileged user.
USER phaser:phaser
CMD ["/phaser/phaser", "--help"]
LABEL maintainer="Sylvain Kerkour <https://kerkour.com>"
LABEL homepage=https://github.com/skerkour/phaser
LABEL org.opencontainers.image.name=phaser
LABEL repository=https://github.com/skerkour/phaser
LABEL org.opencontainers.image.source https://github.com/skerkour/phaser