-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (25 loc) · 892 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
FROM golang:1.16.3 AS golang-builder
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
# [x509: certificate signed by unknown authority를 해결하기 위해서 CA certificates 추가](https://velog.io/@byron1st/x.509-certificate-signed-by-unknown-authority)
RUN apt-get update && apt-get -y upgrade && apt-get install ca-certificates
WORKDIR /build
COPY ./go.mod ./
COPY ./go.sum ./
RUN go mod download
COPY ./ ./
RUN go build -o main ./
WORKDIR /dist
RUN cp /build/main ./
RUN cp /build/configs/config.prod.json ./
FROM scratch
LABEL author="parkgang[Kyungeun Park]<[email protected]>"
LABEL version="0.1.0"
ENV GO_ENV=production
COPY --from=golang-builder /dist/main ./
COPY --from=golang-builder /dist/config.prod.json ./configs/config.prod.json
COPY --from=golang-builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
EXPOSE 8080
ENTRYPOINT ["/main"]