Skip to content

Commit

Permalink
Build multi-platform images for both linux-amd64 and linux-arm64 runn…
Browse files Browse the repository at this point in the history
…ers (#102)

* feat: build multi-platforms images

* feat: upgrade actions

* fix: add support for multi-platforms by QEMU
  • Loading branch information
wangyoucao577 committed Nov 13, 2022
1 parent 9139a11 commit 33a4ba6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/autobuild.yml
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set DOCKER_REPO_NAME env
run: echo DOCKER_REPO_NAME=$(basename ${GITHUB_REPOSITORY}) >> ${GITHUB_ENV}
- name: Set IMAGE_TAG env
Expand All @@ -27,22 +27,31 @@ jobs:
- name: Environment Printer
uses: managedkaos/print-env@v1.0

# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build & Publish to Github Container Registry
uses: elgohr/Publish-Docker-Github-Action@master
uses: elgohr/Publish-Docker-Github-Action@v4
with:
name: ${{ github.actor }}/${{ env.DOCKER_REPO_NAME }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
platforms: linux/amd64,linux/arm64
registry: ghcr.io
snapshot: false
tags: "${{ env.IMAGE_TAG }}"

- name: Build & Publish to DockerHub
uses: elgohr/Publish-Docker-Github-Action@master
uses: elgohr/Publish-Docker-Github-Action@v4
with:
name: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
platforms: linux/amd64,linux/arm64
snapshot: false
tags: "${{ env.IMAGE_TAG }}"

2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Environment Printer
uses: managedkaos/print-env@v1.0

Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set DOCKER_REPO_NAME env
run: echo DOCKER_REPO_NAME=$(basename ${GITHUB_REPOSITORY}) >> ${GITHUB_ENV}
- name: Set IMAGE_TAG env
Expand All @@ -24,9 +24,16 @@ jobs:
run: echo IMAGE_TAG=${IMAGE_TAG},latest >> ${GITHUB_ENV}
- name: Environment Printer
uses: managedkaos/print-env@v1.0


# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build & Publish to Github Container Registry
uses: elgohr/Publish-Docker-Github-Action@master
uses: elgohr/Publish-Docker-Github-Action@v4
with:
name: ${{ github.actor }}/${{ env.DOCKER_REPO_NAME }}
username: ${{ github.actor }}
Expand All @@ -37,7 +44,7 @@ jobs:
tags: "${{ env.IMAGE_TAG }}"

- name: Build & Publish to DockerHub
uses: elgohr/Publish-Docker-Github-Action@master
uses: elgohr/Publish-Docker-Github-Action@v4
with:
name: ${{ github.repository }}
username: ${{ github.actor }}
Expand Down

0 comments on commit 33a4ba6

Please sign in to comment.