buildx #2405
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: buildx | |
| on: | |
| schedule: | |
| - cron: "17 17 * * *" | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| buildx: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| docker-file: | |
| - path: 20 | |
| tags: "20 iron" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 20/slim | |
| tags: "20-slim iron-slim" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 20/alpine | |
| tags: "20-alpine iron-alpine" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 22 | |
| tags: "22 jod latest" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 22/slim | |
| tags: "22-slim jod-slim slim" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 22/alpine | |
| tags: "22-alpine jod-alpine alpine" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 24 | |
| tags: "24 krypton" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 24/slim | |
| tags: "24-slim krypton-slim" | |
| platforms: linux/amd64,linux/arm64 | |
| - path: 24/alpine | |
| tags: "24-alpine krypton-alpine" | |
| platforms: linux/amd64,linux/arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - name: Prepare | |
| id: prepare | |
| run: | | |
| DOCKER_IMAGE=timbru31/node-chrome | |
| TEMP="${{ matrix.docker-file.tags }}" | |
| TAGZ=($TEMP) | |
| VERSION=${TAGZ[0]} | |
| for i in "${!TAGZ[@]}"; do | |
| if [ "$i" -eq "0" ]; | |
| then | |
| TAGS="${DOCKER_IMAGE}:${TAGZ[$i]}" | |
| else | |
| TAGS="${TAGS},${DOCKER_IMAGE}:${TAGZ[$i]}" | |
| fi | |
| done | |
| echo "docker_image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3.7.0 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3.12.0 | |
| with: | |
| install: true | |
| - name: Available platforms | |
| run: echo ${{ steps.buildx.outputs.platforms }} | |
| - name: Docker Buildx (build) | |
| uses: docker/build-push-action@v6.18.0 | |
| if: success() && !contains(github.ref, 'master') | |
| with: | |
| push: false | |
| context: ./${{ matrix.docker-file.path }} | |
| file: ./${{ matrix.docker-file.path }}/Dockerfile | |
| build-args: REFRESHED_AT=$(date +%Y-%m-%d) | |
| platforms: ${{ matrix.docker-file.platforms }} | |
| tags: ${{ steps.prepare.outputs.tags }} | |
| - name: Docker Login | |
| if: success() && contains(github.ref, 'master') | |
| uses: docker/login-action@v3.7.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Docker Buildx (push) | |
| uses: docker/build-push-action@v6.18.0 | |
| if: success() && contains(github.ref, 'master') | |
| with: | |
| push: true | |
| context: ./${{ matrix.docker-file.path }} | |
| file: ./${{ matrix.docker-file.path }}/Dockerfile | |
| build-args: REFRESHED_AT=$(date +%Y-%m-%d) | |
| platforms: ${{ matrix.docker-file.platforms }} | |
| tags: ${{ steps.prepare.outputs.tags }} | |
| - name: Inspect Image | |
| if: always() && github.event_name != 'pull_request' && contains(github.ref, 'master') | |
| run: | | |
| docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} | |
| - name: Clear | |
| if: always() && github.event_name != 'pull_request' | |
| run: | | |
| rm -f ${HOME}/.docker/config.json |