Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make Docker images ARM-friendly #1193

Merged
merged 3 commits into from
May 9, 2022
Merged

feat: make Docker images ARM-friendly #1193

merged 3 commits into from
May 9, 2022

Conversation

shubha-rajan
Copy link
Contributor

@shubha-rajan shubha-rajan commented May 6, 2022

Change Description

Enable multiarchitecture builds in Cloud Build to make our Docker images compatible with ARM64 Linux and MacOS.

Fixes #798

Copy link
Member

@enocom enocom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built all three containers in my test project, confirmed that the manifest for each includes both architectures, and that each container can start the proxy without issue on Linux. I don't have an M1 machine, but trust the Docker will do the right thing.

image

RUN go get ./...
RUN go build -ldflags "-X main.metadataString=container.alpine" -o cloud_sql_proxy ./cmd/cloud_sql_proxy
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
Copy link
Member

@enocom enocom May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My uninformed opinion is that we should always build static binaries, including for Alpine and Buster. However, this is a change from previous versions. Do we need to disable CGO for the multi arch builds? If not, let's remove this from the diff in this and buster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this removing the CGO_ENABLED=0 flag on my M1 mac and it works, so I agree, let's remove from the diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish a container image for Apple M1 machines
2 participants