-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
koddr
committed
Jul 25, 2020
1 parent
4610225
commit 3474dbc
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM golang:1.14-alpine AS builder | ||
|
||
# Move to working directory (/build). | ||
WORKDIR /build | ||
|
||
# Copy and download dependency using go mod. | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy the code into the container. | ||
COPY . . | ||
|
||
# Set necessary environmet variables needed for our image and build the API server. | ||
ENV GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 | ||
RUN go build -ldflags="-w -s" -o apiserver . | ||
|
||
FROM scratch | ||
|
||
# Copy binary and config files from /build to root folder of scratch container. | ||
COPY --from=builder ["/build/apiserver", "/build/configs/apiserver.yml", "/"] | ||
|
||
# Export necessary port. | ||
EXPOSE 5000 | ||
|
||
# Command to run when starting the container. | ||
ENV CONFIG_PATH=/apiserver.yml | ||
ENTRYPOINT ["/apiserver"] |