-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (26 loc) · 1.03 KB
/
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
# original is https://github.com/GoogleCloudPlatform/cloud-code-samples/blob/v1/golang/go-hello-world/Dockerfile
# Use base golang image from Docker Hub
FROM golang:1.15 AS build
WORKDIR /crawler
# 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 ./src ./src
# 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 ./src
# 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 assets
WORKDIR /crawler
COPY --from=build /app ./app
COPY favorites.json favorites.json
COPY ./src/details/ccode.json ./src/subject/ccode.json
ENTRYPOINT ["./app"]