Skip to content

Commit

Permalink
Add linux arm64 images to the build process (#405)
Browse files Browse the repository at this point in the history
* Add linux arm64 images to the build process

* Fix GOARCH
  • Loading branch information
ivan-leschinsky authored Oct 21, 2023
1 parent 8c99dec commit 8470ae2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/build_and_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,31 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: agilepathway/pull-request-label-checker
tags: |
type=ref,event=branch
type=sha
- name: Build and push Docker image
# Skip running on forks or Dependabot since neither has access to secrets
if: |
(github.repository == 'agilepathway/label-checker') &&
(github.actor!= 'dependabot[bot]') &&
(contains(github.head_ref, 'dependabot/github_actions/') == false)
uses: docker/build-push-action@v1.1.0
uses: docker/build-push-action@v5
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: agilepathway/pull-request-label-checker
tag_with_ref: true
tags: ${{ steps.meta.outputs.tags }}
push: true
platforms: linux/amd64,linux/arm64
15 changes: 12 additions & 3 deletions .github/workflows/github_tag_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,18 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: agilepathway/pull-request-label-checker
tags: ${{ needs.tag.outputs.tag }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
tags: agilepathway/pull-request-label-checker:${{ needs.tag.outputs.tag }}
platforms: linux/amd64,linux/arm64
push: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM golang:1.21.1-bullseye AS builder
WORKDIR /src
COPY . .

RUN CGO_ENABLED=0 GOFLAGS=-ldflags="-w" GOOS=linux GOARCH=amd64 go build -o /bin/check-labels label_checker.go \
RUN CGO_ENABLED=0 GOFLAGS=-ldflags="-w" GOOS=linux GOARCH=${BUILDARCH} go build -o /bin/check-labels label_checker.go \
# Strip any symbols - this is not a library
&& strip /bin/check-labels \
# Compress the compiled action using UPX (https://upx.github.io/)
Expand Down

0 comments on commit 8470ae2

Please sign in to comment.