-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
33 lines (23 loc) · 632 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
# === BUILD STAGE === #
FROM golang:1.12-alpine as build
ARG ACCESS_TOKEN
RUN apk add --no-cache git
WORKDIR /srv/app
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go test -v ./...
RUN go build -ldflags="-w -s" -o build
# === RUN STAGE === #
FROM alpine as run
RUN apk update \
&& apk upgrade \
&& apk add --no-cache ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
WORKDIR /srv/app
COPY --from=build /srv/app/build /srv/app/build
ENV LISTEN_ADDRESS 0.0.0.0:8080
ENV GIN_MODE release
CMD ["/srv/app/build"]