-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
41 lines (29 loc) · 954 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
35
36
37
38
39
40
41
# This is a multi-stage Dockerfile and requires >= Docker 17.05
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
FROM golang:1.16-alpine as builder
RUN apk add --no-cache git
RUN apk add --no-cache git
ENV GO111MODULE on
ENV GOPROXY "https://proxy.golang.org/"
RUN mkdir -p /src/apple-wwdc21-demo
WORKDIR /src/apple-wwdc21-demo
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
ADD . .
RUN go build -o /bin/app
######## Dockerize
FROM alpine
RUN apk add --no-cache bash
RUN apk add --no-cache ca-certificates
WORKDIR /bin/
COPY --from=builder /bin/app .
COPY ./assets /bin/assets
COPY ./templates /bin/templates
# Uncomment to run the binary in "production" mode:
# ENV GO_ENV=production
EXPOSE 9000
ENTRYPOINT /bin/app