-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
38 lines (26 loc) · 883 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
########################### Build Base ###########################
FROM golang:1.19-alpine as build_base
RUN apk add git make
# Add the current directory to be build
WORKDIR /app
######## Environment variables ########
# Force the go compiler to use modules
ENV GO111MODULE=on
# Disable Go proxy
ENV GOPROXY=direct
######## Install dependencies ########
COPY go.mod .
COPY go.sum .
COPY Makefile .
RUN make setup
############################# Builder ############################
FROM build_base AS builder
COPY . /app
# Build the image for Linux instances
RUN make build
############################# Runner #############################
FROM alpine:latest
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
RUN update-ca-certificates
COPY --from=builder /app/golang_api_skeleton /app/golang_api_skeleton
ENTRYPOINT ["/app/golang_api_skeleton", "api"]