2
0

💚 Fix docker multi arch overwrite issue (#779)

Closes #776
This commit is contained in:
Baptiste Arnaud
2023-09-07 09:43:38 +02:00
committed by GitHub
parent 6651f01aa7
commit b90b6d0b25

View File

@ -33,8 +33,7 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- if: github.event_name != 'pull_request' - name: Log in to Docker Hub
name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@ -44,18 +43,29 @@ jobs:
id: docker_build id: docker_build
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
push: ${{ github.event_name != 'pull_request' }}
context: . context: .
tags: ${{ steps.image-meta.outputs.tags }} tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }} labels: ${{ steps.image-meta.outputs.labels }}
outputs: type=image,name=baptistearno/typebot-${{ matrix.app }},push-by-digest=true,name-canonical=true,push=true
platforms: linux/amd64 platforms: linux/amd64
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build-args: | build-args: |
SCOPE=${{ matrix.app }} SCOPE=${{ matrix.app }}
- name: Image digest - name: Export digest
run: echo ${{ steps.docker_build.outputs.digest }} run: |
mkdir -p /tmp/digests
digest="${{ steps.docker_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
build-arm: build-arm:
env: env:
@ -82,8 +92,7 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- if: github.event_name != 'pull_request' - name: Log in to Docker Hub
name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@ -93,15 +102,62 @@ jobs:
id: docker_build id: docker_build
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
push: ${{ github.event_name != 'pull_request' }}
context: . context: .
tags: ${{ steps.image-meta.outputs.tags }} tags: ${{ steps.image-meta.outputs.tags }}
labels: ${{ steps.image-meta.outputs.labels }} labels: ${{ steps.image-meta.outputs.labels }}
outputs: type=image,name=baptistearno/typebot-${{ matrix.app }},push-by-digest=true,name-canonical=true,push=true
platforms: linux/arm64 platforms: linux/arm64
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
build-args: | build-args: |
SCOPE=${{ matrix.app }} SCOPE=${{ matrix.app }}
- name: Image digest - name: Export digest
run: echo ${{ steps.docker_build.outputs.digest }} run: |
mkdir -p /tmp/digests
digest="${{ steps.docker_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:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs:
- build-amd
- build-arm
strategy:
matrix:
app: ['builder', 'viewer']
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: baptistearno/typebot-${{ matrix.app }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'baptistearno/typebot-${{ matrix.app }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect baptistearno/typebot-${{ matrix.app }}:${{ steps.meta.outputs.version }}