Skip to content

Commit

Permalink
fix: build statically linked binaries (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwotherspoon committed Feb 23, 2023
1 parent aad0289 commit 75c05a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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/alloydb-auth-proxy
COPY . .
Expand All @@ -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/alloydb-auth-proxy/cmd.metadataString=container.alpine"

# Final stage
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -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/alloydb-auth-proxy/cmd.metadataString=container.bullseye"

# Final stage
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.buster
Original file line number Diff line number Diff line change
Expand Up @@ -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/alloydb-auth-proxy/cmd.metadataString=container.buster"

# Final stage
Expand Down

0 comments on commit 75c05a6

Please sign in to comment.