forked from karlkfi/pagerbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 791 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 791 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
31
32
33
# build image
FROM golang:1.11.2-alpine3.8 as builder
RUN apk update && apk add git && apk add ca-certificates
# create non-root user
RUN adduser -D -g '' appuser
COPY . $GOPATH/src/karlkfi/pagerbot/
WORKDIR $GOPATH/src/karlkfi/pagerbot/
# download dependencies
ENV GO111MODULE=on
RUN go get -d -v
# compile static binary
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/pagerbot
# distributable image
FROM alpine:3.8
# copy dependencies
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd
# copy static executable
COPY --from=builder /go/bin/pagerbot /go/bin/pagerbot
# copy default config
COPY config.yml /
# use non-root user
USER appuser
CMD ["/go/bin/pagerbot"]