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

Add linux arm64 images to the build process #405

Merged
merged 2 commits into from
Oct 21, 2023
Merged
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
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