-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
31 lines (23 loc) · 866 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
# Use base golang image from Docker Hub
FROM golang:1.19 AS build
WORKDIR /ekyc-services-name
# Install dependencies in go.mod and go.sum
COPY go.mod go.sum ./
RUN go mod download
# Copy rest of the application source code
COPY . ./
# Compile the application to /app.
# Skaffold passes in debug-oriented compiler flags
ARG SKAFFOLD_GO_GCFLAGS
RUN echo "Go gcflags: ${SKAFFOLD_GO_GCFLAGS}"
RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -mod=readonly -v -o /app
# Now create separate deployment image
FROM gcr.io/distroless/base
# Definition of this variable is used by 'skaffold debug' to identify a golang binary.
# Default behavior - a failure prints a stack trace for the current goroutine.
# See https://golang.org/pkg/runtime/
ENV GOTRACEBACK=single
# Copy template & assets
WORKDIR /ekyc-services-name
COPY --from=build /app ./app
ENTRYPOINT ["./app"]