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

Improve Docker Build and Deployment for Multi-Arch Support (arm64) #31

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 12 additions & 18 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,24 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,format=long,prefix=

- name: Docker Build
uses: docker/build-push-action@v5
with:
cache-from: ${{ env.GHCR_REGISTRY_IMAGE }}:latest
pull: true
platforms: linux/amd64,linux/arm64
file: docker/Dockerfile
tags: ${{ env.GHCR_REGISTRY_IMAGE }}:${{ github.sha }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
push: true
build-args: |
COMMIT_HASH=${{ github.sha }}

deploy-docker:
runs-on: ubuntu-latest
needs:
- build-docker
if: github.ref == 'refs/heads/main'
steps:
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: beeper/docker-retag-push-latest@main
with:
image: ${{ env.GHCR_REGISTRY_IMAGE }}