-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
28 lines (19 loc) · 613 Bytes
/
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
# Stage 1. Build the binary
FROM golang:1.11
# add a non-privileged user
RUN useradd -u 10001 myapp
RUN mkdir -p /go/src/github.com/fred01/k8meetup
ADD . /go/src/github.com/fred01/k8meetup
WORKDIR /go/src/github.com/fred01/k8meetup
# build the binary with go build
RUN CGO_ENABLED=0 go build \
-o bin/nsk /go/src/github.com/fred01/k8meetup/cmd/nsk
# Stage 2. Run the binary
FROM scratch
ENV PORT 8080
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=0 /etc/passwd /etc/passwd
USER myapp
COPY --from=0 /go/src/github.com/fred01/k8meetup/bin/nsk /nsk
EXPOSE $PORT
CMD ["/nsk"]