Skip to content

Commit

Permalink
Revise docker actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyun committed Apr 7, 2024
1 parent da07f29 commit c9a4923
Showing 1 changed file with 7 additions and 48 deletions.
55 changes: 7 additions & 48 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
name: docker
on: [push]
env:
REGISTRY_IMAGE: cropbox/cropbox
jobs:
build:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
platform: [linux/amd64, linux/arm64]
runs-on: ubuntu-latest
steps:
- run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: rlespinasse/github-slug-action@v4
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
Expand All @@ -27,39 +17,8 @@ jobs:
- uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: macos-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- uses: docker/setup-buildx-action@v3
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- 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 ' *)
- run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
file: .binder/Dockerfile
platforms: linux/amd64,linux/arm64
build-args: REPO_DIR=/home/Cropbox.jl
push: true
tags: cropbox/cropbox:${{ env.GITHUB_REF_SLUG }}

0 comments on commit c9a4923

Please sign in to comment.