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

fix: Add ARM64 support for Docker builds #4164

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/reusable_dockerfile_pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Remove or comment out old build steps for amd64
# ...

# Add a single step for multi-platform build
- name: Build and push multi-platform image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARG UPGRADE_HEIGHT_DELAY
# Ignore hadolint rule because hadolint can't parse the variable.
# See https://github.com/hadolint/hadolint/issues/339
# hadolint ignore=DL3006
FROM --platform=$BUILDPLATFORM ${BUILDER_IMAGE} AS builder
FROM --platform=$TARGETPLATFORM golang:1.21-alpine AS builder
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: Review base image configuration.

Several issues need attention in the base image configuration:

  1. The previous version 1.23.1 doesn't exist (Go 1.21 is current stable)
  2. Using non-specific patch version (1.21 vs 1.21.x) could lead to build inconsistency
  3. Removed explicit registry reference (docker.io/) might affect availability

Apply this fix:

-FROM --platform=$TARGETPLATFORM golang:1.21-alpine AS builder
+FROM --platform=$TARGETPLATFORM docker.io/golang:1.21.5-alpine AS builder
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FROM --platform=$TARGETPLATFORM golang:1.21-alpine AS builder
FROM --platform=$TARGETPLATFORM docker.io/golang:1.21.5-alpine AS builder

ENV CGO_ENABLED=0
ENV GO111MODULE=on
# hadolint ignore=DL3018
Expand Down
Loading