Skip to content

Commit

Permalink
Update docker workflow to build multiarch image. (#3350)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassot committed May 21, 2023
1 parent 46ea490 commit e10c297
Showing 1 changed file with 59 additions and 5 deletions.
64 changes: 59 additions & 5 deletions .github/workflows/publish_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ on:
- happy-plazza
- qw*
- v*
env:
REGISTRY_IMAGE: quickwit/quickwit

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux/amd64
- os: buildjet-4vcpu-ubuntu-2204-arm
platform: linux/arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -28,7 +37,7 @@ jobs:
uses: docker/metadata-action@v4
with:
images: |
quickwit/quickwit
${{ env.REGISTRY_IMAGE }}
tags: |
type=edge,branch=main
type=edge,branch=main,suffix=-bullseye
Expand All @@ -53,14 +62,59 @@ jobs:
echo "QW_COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "QW_COMMIT_TAGS=$(git tag --points-at HEAD | tr '\n' ',')" >> $GITHUB_ENV
- name: Build and push
- name: Build and push image
uses: docker/build-push-action@v4
id: build
with:
context: .
push: true
platforms: ${{ matrix.platform }}
build-args: |
QW_COMMIT_DATE=${{ env.QW_COMMIT_DATE }}
QW_COMMIT_HASH=${{ env.QW_COMMIT_HASH }}
QW_COMMIT_TAGS=${{ env.QW_COMMIT_TAGS }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-latest
needs: [docker]
steps:
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests
path: /tmp/digests
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
- name: Create manifest list and push tags
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit e10c297

Please sign in to comment.