diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 164336e58..fd8c1d337 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -13,7 +13,7 @@ # limitations under the License. # Use the latest stable golang 1.x to compile to a binary -FROM --platform=$BUILDPLATFORM golang:1 as build +FROM --platform=$BUILDPLATFORM golang:1-alpine as build WORKDIR /go/src/cloud-sql-proxy COPY . . @@ -22,7 +22,7 @@ ARG TARGETOS ARG TARGETARCH RUN go get ./... -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -ldflags "-X github.com/GoogleCloudPlatform/cloud-sql-proxy/v2/cmd.metadataString=container.alpine" # Final stage diff --git a/Dockerfile.bullseye b/Dockerfile.bullseye index e12530e59..045329354 100644 --- a/Dockerfile.bullseye +++ b/Dockerfile.bullseye @@ -22,7 +22,7 @@ ARG TARGETOS ARG TARGETARCH RUN go get ./... -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -ldflags "-X github.com/GoogleCloudPlatform/cloud-sql-proxy/v2/cmd.metadataString=container.bullseye" # Final stage diff --git a/Dockerfile.buster b/Dockerfile.buster index 14b220dfe..bb8fd600a 100644 --- a/Dockerfile.buster +++ b/Dockerfile.buster @@ -22,7 +22,7 @@ ARG TARGETOS ARG TARGETARCH RUN go get ./... -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ +RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \ go build -ldflags "-X github.com/GoogleCloudPlatform/cloud-sql-proxy/v2/cmd.metadataString=container.buster" # Final stage