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

View File

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