forked from traefik/whoami
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (21 loc) · 716 Bytes
/
Dockerfile
File metadata and controls
30 lines (21 loc) · 716 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:1-alpine as builder
RUN adduser --uid 2000 --disabled-password user
RUN apk --no-cache --no-progress add git ca-certificates tzdata make \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
WORKDIR /go/whoami
# Download go modules
COPY go.mod .
COPY go.sum .
RUN GO111MODULE=on GOPROXY=https://proxy.golang.org go mod download
COPY . .
RUN make build
# Create a minimal container to run a Golang static binary
FROM scratch
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/whoami/whoami .
COPY --from=builder /etc/passwd /etc/passwd
USER 2000
ENTRYPOINT ["/whoami"]
EXPOSE 8080