-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (26 loc) · 894 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
# Start by building the application.
FROM golang:1.20.5-buster as build
WORKDIR /go/src/github.com/transnano/pagerduty-api/
# For building Go Module required
ENV GOPROXY=direct
ENV GO111MODULE=on
ENV GOARCH=amd64
ENV GOOS=linux
ENV CGO_ENABLED=0
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY . .
# Build
RUN go build -a -o pagerduty-api -ldflags "-s -w \
-X 'main.Version=$(git describe --tags --abbrev=0)'"
# hadolint ignore=DL3006
FROM gcr.io/distroless/base-debian10
#FROM gcr.io/distroless/base
LABEL maintainer="Transnano <[email protected]>"
COPY --from=build /go/src/github.com/transnano/pagerduty-api/pagerduty-api /
ENTRYPOINT ["/pagerduty-api"]