Build with CGO_ENABLED=0 in Dockerfile

- Not strictly necessary at the moment because both our build layer
  and our run layer are based on alpine, but static linking our binary
  will help us later when we want to base our run image on something
  closer to scratch
This commit is contained in:
Ryan Richard 2020-08-05 17:43:24 -07:00
parent da5b509cc6
commit dd278b46a8
1 changed files with 2 additions and 2 deletions

View File

@ -33,8 +33,8 @@ COPY internal ./internal
COPY pkg ./pkg
COPY tools ./tools
COPY hack ./hack
# Build the executable binary
RUN GOOS=linux GOARCH=amd64 go build -ldflags "$(hack/get-ldflags.sh)" -o out ./cmd/placeholder-name-server/...
# Build the executable binary (CGO_ENABLED=0 means static linking)
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(hack/get-ldflags.sh)" -o out ./cmd/placeholder-name-server/...
FROM alpine:latest
# Install CA certs and some tools for debugging