Skip to content

Commit

Permalink
feat: add arm64 to docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Nov 12, 2024
1 parent 8256a10 commit 8d44210
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Build image
run: docker build . --file Dockerfile.alpine --tag "$IMAGE_NAME" --label "runnumber=${GITHUB_RUN_ID}"
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Push image
run: |
IMAGE_ID="ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME"
IMAGE_VERSION="${GITHUB_REF##*/v}"
docker tag "$IMAGE_NAME" "$IMAGE_ID:$IMAGE_VERSION"
docker tag "$IMAGE_NAME" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:$IMAGE_VERSION"
docker push "$IMAGE_ID:latest"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Push image
run: |
IMAGE_ID="$DOCKERHUB_IMAGE"
IMAGE_VERSION="${GITHUB_REF##*/v}"
docker tag "$IMAGE_NAME" "$IMAGE_ID:$IMAGE_VERSION"
docker tag "$IMAGE_NAME" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:$IMAGE_VERSION"
docker push "$IMAGE_ID:latest"
- name: Set version tag
run: echo "IMAGE_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV

- name: Build images
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
file: ./Dockerfile
tags: |
"ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest"
"ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}"
"${{ env.DOCKERHUB_IMAGE }}:latest"
"${{ env.DOCKERHUB_IMAGE }}:${{ env.IMAGE_VERSION }}"

0 comments on commit 8d44210

Please sign in to comment.