-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (24 loc) · 788 Bytes
/
Dockerfile
File metadata and controls
30 lines (24 loc) · 788 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
27
28
29
30
FROM golang:alpine as golang
RUN apk --update --no-cache add ca-certificates && update-ca-certificates
WORKDIR /go/src
COPY src/ .
RUN CGO_ENABLED=0 go install -ldflags '-extldflags "-static"' github.com/abrie/mapatlapi/cmd/cli
# See https://stackoverflow.com/a/55757473/12429735
ENV USER=appuser
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
FROM scratch
COPY --from=golang /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=golang /go/bin/cli /app
COPY --from=golang /etc/passwd /etc/passwd
COPY --from=golang /etc/group /etc/group
# Use unprivileged, non-root user.
USER appuser:appuser
ENTRYPOINT ["/app"]