Skip to content

Commit

Permalink
ci(docker): update GitHub actions and multi-arch build
Browse files Browse the repository at this point in the history
- Update the `checkout` action to version 4
- Update the `metadata-action` to version 5
- Add the `setup-qemu` action
- Add the `setup-buildx` action
- Update the `login-action` to version 3 for DockerHub and GitHub Container Registry
- Update the `build-push-action` to version 5 and add `target` and `platforms` options

Signed-off-by: 陳鈞 <[email protected]>
  • Loading branch information
jim60105 committed Dec 21, 2023
1 parent 419d352 commit 6d5ce88
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,51 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ryu1845/${{ github.event.repository.name }},ghcr.io/${{ github.repository }}
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
prefix=
suffix=
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

# Create a Access Token and save it as as Actions secret
# https://hub.docker.com/settings/security
# DOCKERHUB_USERNAME
# DOCKERHUB_TOKEN
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ryu1845
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Create a Access Token with `read:packages` and `write:packages` scopes
# CR_PAT
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: true
target: final
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

0 comments on commit 6d5ce88

Please sign in to comment.