-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
31 lines (21 loc) · 856 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
29
30
31
############################
# STEP 1 build executable binary
############################
FROM golang:1.12-alpine as builder
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apk update && apk add --no-cache git ca-certificates tzdata && update-ca-certificates
RUN adduser -D -g '' appuser
WORKDIR $GOPATH/src/dokku-go-dockerfile/
COPY . .
RUN go get -u github.com/golang/dep/cmd/dep && dep ensure
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/dokku-go-dockerfile .
############################
# STEP 2 build a small image
############################
FROM alpine:latest
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /go/bin/dokku-go-dockerfile /go/bin/dokku-go-dockerfile
USER appuser
ENTRYPOINT ["/go/bin/dokku-go-dockerfile"]