forked from mailgun/gubernator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (24 loc) · 764 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
32
33
34
# Build image
FROM golang:1.15.4 as build
WORKDIR /go/src
# This should create cached layer of our dependencies for subsequent builds to use
COPY go.mod /go/src
COPY go.sum /go/src
RUN go mod download
# Copy the local package files to the container
ADD . /go/src
ARG VERSION
# Build the server inside the container
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo \
-ldflags "-w -s -X main.Version=$VERSION" -o /gubernator /go/src/cmd/gubernator/main.go
# Create our deploy image
FROM scratch
# Certs for ssl
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy our static executable.
COPY --from=build /gubernator /gubernator
# Run the server
ENTRYPOINT ["/gubernator"]
EXPOSE 80
EXPOSE 81
EXPOSE 7946