Skip to content

Commit

Permalink
Add arm64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj5 committed Jul 10, 2024
1 parent e5872c5 commit 82952b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}

- name: Build operator and Tag Latest
run: make docker-build
env:
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Login to Registry
uses: docker/login-action@v3
Expand All @@ -42,7 +44,12 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push latest operator
run: make docker-push
env:
IMG: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:latest
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ env.REGISTRY_URL }}/${{ env.ORG }}/${{ env.REPO }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build the manager binary
FROM golang:1.21 as builder
FROM --platform=$BUILDPLATFORM golang:1.21 as builder

ARG TARGETOS TARGETARCH

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -18,7 +20,7 @@ COPY version/ version/

# Build
ARG LD_FLAGS
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="$LD_FLAGS" -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="$LD_FLAGS" -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down

0 comments on commit 82952b7

Please sign in to comment.