-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
32 lines (23 loc) · 813 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
FROM golang:1.21-alpine AS builder
# Move to working directory (/build).
WORKDIR /build
# Copy and download dependency using go mod.
COPY go.mod go.sum ./
RUN go mod download
# Copy the code into the container.
COPY . ./
# Set necessary environment variables needed
# for our image and build the api.
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
RUN go build -ldflags="-s -w" -o main ./main.go
FROM scratch
# Copy cert to interact with GCP
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy binary and config files from /build
# to root folder of scratch container.
COPY --from=builder ["/build/main", "/"]
# Copy migrations
COPY ./provider/db/migrations /migrations
COPY ./provider/translation/locales /locales
# Command to run when starting the container.
ENTRYPOINT ["/main"]