-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.heroku
52 lines (39 loc) · 1.47 KB
/
Dockerfile.heroku
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
42
43
44
45
46
47
48
49
50
51
52
###
# Step 1 - Compile
###
FROM golang:1.14-alpine AS builder
ARG component=${component:-key-retrieval}
ARG branch
ARG revision
ENV GO111MODULE=on
ENV USER=covidshield
ENV UID=10001
ENV GOLDFLAGS="-X github.com/covid-tracing-mongolia/backend-server/pkg/server.branch=${branch} -X github.com/covid-tracing-mongolia/backend-server/pkg/server.revision=${revision}"
WORKDIR /go/src/github.com/covid-tracing-mongolia/backend-server
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="${GOLDFLAGS}" -o server ./cmd/monolith
RUN mkdir /etc/aws-certs
RUN wget -P /etc/aws-certs https://s3.amazonaws.com/rds-downloads/rds-ca-2019-root.pem
###
# Step 2 - Build
###
FROM alpine
RUN apk add --no-cache bash
ARG PORT
WORKDIR /usr/local/bin
# Import the user and group files from step 1
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY --from=builder /etc/aws-certs /etc/aws-certs
COPY --from=builder /go/src/github.com/covid-tracing-mongolia/backend-server/config.yaml /usr/local/bin/config.yaml
COPY --from=builder /go/src/github.com/covid-tracing-mongolia/backend-server/server /usr/local/bin/server
COPY --from=builder /go/src/github.com/covid-tracing-mongolia/backend-server/scripts/heroku_run.sh /usr/local/bin/heroku_run.sh
ENTRYPOINT ["/usr/local/bin/heroku_run.sh"]