Skip to content

Multi Platform Support#18

Merged
aryanmehrotra merged 5 commits intozopdev:mainfrom
akshat-kumar-singhal:main
Mar 9, 2026
Merged

Multi Platform Support#18
aryanmehrotra merged 5 commits intozopdev:mainfrom
akshat-kumar-singhal:main

Conversation

@akshat-kumar-singhal
Copy link
Contributor

  • Added support for arm64
  • Updated action versions
  • Added step to print the image registry path

akshat-kumar-singhal and others added 5 commits February 27, 2026 11:28
Enable native arm64 support for Apple Silicon users by building
multi-architecture images via buildx. Uses TARGETARCH for explicit
Go cross-compilation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Required for arm64 emulation on amd64 runners.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace QEMU emulation with native cross-compilation by adding
--platform=$BUILDPLATFORM to the build stage. Go cross-compiles
to the target architecture natively, eliminating slow emulation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- actions/checkout v4 → v6
- actions/setup-go v4 → v6 (caching now enabled by default)
- golangci/golangci-lint-action v8 → v9
- Add step to output pushed image registry path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the build/release pipeline to publish multi-architecture Docker images (amd64 + arm64) and refreshes related CI action versions, alongside a README image tag bump.

Changes:

  • Cross-compiles the Go binary for the target architecture during Docker builds and publishes linux/amd64 + linux/arm64 images via Buildx.
  • Updates GitHub Action versions and adds a step to print the pushed image tag.
  • Updates the README example image version to zopdev/static-server:v0.0.7.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
README.md Bumps the documented prebuilt image tag from v0.0.6 to v0.0.7.
Dockerfile Uses BuildKit platform args to cross-compile for multi-arch builds.
.github/workflows/go.yaml Updates actions, builds/pushes multi-arch images, and prints the resulting image tag.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# Build stage
FROM golang:1.26 AS build
# Build stage - runs on native platform, cross-compiles to target
FROM --platform=$BUILDPLATFORM golang:1.26 AS build
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The Docker image uses golang:1.26, but go.mod declares go 1.25.0. If 1.26 is required, consider updating go.mod (and any local/toolchain docs) to match; otherwise pin the Docker build stage to the same Go version as go.mod to avoid CI/local mismatches.

Suggested change
FROM --platform=$BUILDPLATFORM golang:1.26 AS build
FROM --platform=$BUILDPLATFORM golang:1.25.0 AS build

Copilot uses AI. Check for mistakes.
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /app/main main.go

ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /app/main main.go
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

ARG TARGETARCH is required for the GOARCH=${TARGETARCH} build. If someone builds with a non-BuildKit/legacy builder where TARGETARCH isn't automatically provided, this will produce an empty GOARCH and fail the build. Consider adding a safe default (e.g., fall back to go env GOARCH) so docker build . works reliably without requiring extra flags.

Suggested change
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /app/main main.go
RUN export GOARCH=${TARGETARCH:-$(go env GOARCH)} \
&& CGO_ENABLED=0 GOOS=linux GOARCH=$GOARCH go build -ldflags="-s -w" -o /app/main main.go

Copilot uses AI. Check for mistakes.
Comment on lines +16 to 19
- uses: actions/setup-go@v6
with:
go-version: '1.26'
cache: true
- name: Test
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Go version in CI is pinned to 1.26 while go.mod declares go 1.25.0. To keep toolchains consistent across local builds, Docker builds, and CI, consider aligning these (either bump go.mod to 1.26 if intended, or run CI with 1.25.x).

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +30
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: '1.26'
cache: true
- uses: golangci/golangci-lint-action@v8
- uses: golangci/golangci-lint-action@v9
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

actions/setup-go no longer enables module/build caching here (the previous cache: true was removed and there’s no actions/cache usage elsewhere). This will slow down PR CI runs; consider re-enabling caching (via setup-go’s cache option if still supported, or explicit actions/cache for ~/go/pkg/mod and ~/.cache/go-build).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

actions/setup-go@v6 has cache enabled by default

@aryanmehrotra aryanmehrotra merged commit 4cb4390 into zopdev:main Mar 9, 2026
8 checks passed
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.

3 participants