forked from knative/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (23 loc) · 964 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 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 as builder
# Install dep
RUN go get -u github.com/golang/dep/cmd/dep
# Copy local code to the container image.
WORKDIR /go/src/github.com/knative/docs/hellosecrets
COPY . .
# Fetch dependencies
RUN dep init
RUN dep ensure
# Build the output command inside the container.
RUN CGO_ENABLED=0 GOOS=linux go build -v -o hellosecrets
# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine
# Enable the use of outbound https
RUN apk add --no-cache ca-certificates
# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/github.com/knative/docs/hellosecrets/hellosecrets /hellosecrets
# Run the web service on container startup.
CMD ["/hellosecrets"]