-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathdoc.Dockerfile
More file actions
34 lines (26 loc) · 1021 Bytes
/
doc.Dockerfile
File metadata and controls
34 lines (26 loc) · 1021 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
32
33
34
# Use the official Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.13 as builder
WORKDIR /go/app/
# Copy and cache dependencies
COPY ../go.mod .
COPY ../go.sum .
# Retrieve application dependencies.
# This allows the container build to reuse cached dependencies as long as go.mod and go.sum are unchanged.
RUN go mod download
# Copy internal libraries.
COPY . .
# Build the binary.
RUN CGO_ENABLED=0 GOOS=linux go build -o doc -mod=readonly -v ./cmd/doc/main.go
# Use the official Alpine image for a lean production container.
# https://hub.docker.com/_/alpine
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine:3
RUN apk add --no-cache ca-certificates
# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/app/doc ./
COPY ./template ./template
COPY ./static ./static
# Run the web service on container startup.
ENTRYPOINT ["/doc"]