Skip to content

Commit

Permalink
build multi-platform image + fix variable usage
Browse files Browse the repository at this point in the history
Signed-off-by: Przemysław Grądzki <[email protected]>
  • Loading branch information
przemekgradzki committed Feb 3, 2024
1 parent e9e88b0 commit 83ac676
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
env:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
steps:
-
name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
-
name: Checkout
uses: actions/checkout@v4
Expand All @@ -23,34 +27,30 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (tags, labels) for Docker
-
name: Get current date
run: echo "NOW=$(date -u +'%Y-%m-%d')" >> $env:$GITHUB_ENV
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
labels: |
org.${{ github.repository_owner }}.ontology-publisher.release-date={{date 'YYYY-MM-DD'}}
org.${{ github.repository_owner }}.ontology-publisher.version={{branch}}
-
name: Build and push ${{ github.repository }}:${{ steps.meta.outputs.version }} for linux/amd64 platform
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ env.dockerhub_username != '' }}
tags: ${{ github.repository }}:${{ steps.meta.outputs.version }}
annotations: ${{ steps.meta.outputs.annotations }}
labels: ${{ steps.meta.outputs.labels }}
org.${{ github.repository_owner }}.ontology-publisher.release-date=${{ env.NOW }}
org.${{ github.repository_owner }}.ontology-publisher.version=${{ steps.branch-names.outputs.current_branch }}
-
name: Build and push ${{ github.repository }}:${{ steps.meta.outputs.version }} for linux/arm64 platform
name: Build and push ${{ github.repository }}:${{ steps.meta.outputs.version }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
platforms: linux/amd64,linux/arm64
push: ${{ env.dockerhub_username != '' }}
tags: ${{ github.repository }}:${{ steps.meta.outputs.version }}
annotations: ${{ steps.meta.outputs.annotations }}
Expand Down

0 comments on commit 83ac676

Please sign in to comment.