-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (20 loc) · 722 Bytes
/
Dockerfile
File metadata and controls
31 lines (20 loc) · 722 Bytes
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
FROM golang:latest AS build_base
# RUN apk add --no-cache git
# Set the Current Working Directory inside the container
WORKDIR /tmp/task-manager-go
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# Unit tests
RUN CGO_ENABLED=0 go test -v
# Build the Go app
RUN CGO_ENABLED=0 go build -o ./out/task-manager-go .
# Start fresh from a smaller image
FROM gcr.io/distroless/static
COPY --from=build_base /tmp/task-manager-go/out/task-manager-go /
COPY --from=build_base /tmp/task-manager-go/config.yml /
# This container exposes port 8080 to the outside world
EXPOSE 8080
ENTRYPOINT [ "/task-manager-go" ]