buildx #1423
This file contains 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: "37 04 * * *" | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
docker-file: | |
- path: 8/jdk/16 | |
tags: "8-jdk 8-jdk-16 8-jdk-gallium" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le | |
- path: 8/jdk/18 | |
tags: "8-jdk-18 8-jdk-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le | |
- path: 8/jdk/16/alpine | |
tags: "8-alpine-jdk-16 8-alpine-jdk-gallium 8-alpine-jdk" | |
platforms: linux/amd64 | |
- path: 8/jdk/18/alpine | |
tags: "8-alpine-jdk-18 8-alpine-jdk-hydrogen" | |
platforms: linux/amd64 | |
- path: 8/jre/16 | |
tags: "8-jre-16 8-jre-gallium 8-16 8-gallium 8-jre 8" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le | |
- path: 8/jre/18 | |
tags: "8-jre-18 8-jre-hydrogen 8-18 8-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le | |
- path: 8/jre/16/alpine | |
tags: "8-alpine-16 8-alpine-gallium 8-alpine-jre-16 8-alpine-jre-gallium 8-alpine 8-alpine-jre" | |
platforms: linux/amd64 | |
- path: 8/jre/18/alpine | |
tags: "8-alpine-18 8-alpine-hydrogen 8-alpine-jre-18 8-alpine-jre-hydrogen" | |
platforms: linux/amd64 | |
- path: 11/jdk/16 | |
tags: "11-jdk-16 11-jdk-gallium 11-jdk" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 11/jdk/18 | |
tags: "11-jdk-18 11-jdk-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 11/jdk/16/alpine | |
tags: "11-alpine-jdk-16 11-alpine-jdk-gallium 11-alpine-jdk" | |
platforms: linux/amd64 | |
- path: 11/jdk/18/alpine | |
tags: "11-alpine-jdk-18 11-alpine-jdk-hydrogen" | |
platforms: linux/amd64 | |
- path: 11/jre/16 | |
tags: "11-16 11-gallium 11-jre-16 11-jre-gallium 11 11-jre" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 11/jre/18 | |
tags: "11-18 11-hydrogen 11-jre-18 11-jre-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 11/jre/16/alpine | |
tags: "11-alpine-16 11-alpine-gallium 11-alpine-jre-16 11-alpine-jre-gallium 11-alpine 11-alpine-jre" | |
platforms: linux/amd64 | |
- path: 11/jre/18/alpine | |
tags: "11-alpine-18 11-alpine-hydrogen 11-alpine-jre-18 11-alpine-jre-hydrogen" | |
platforms: linux/amd64 | |
- path: 17/jdk/16 | |
tags: "17-jdk-16 17-jdk-gallium jdk-16 jdk-16-gallium 17-jdk jdk" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 17/jdk/18 | |
tags: "17-jdk-18 17-jdk-hydrogen jdk-18 jdk-18-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 17/jdk/16/alpine | |
tags: "alpine-jdk-16 alpine-jdk-gallium 17-alpine-jdk-16 17-alpine-jdk-gallium alpine-jdk 17-alpine-jdk" | |
platforms: linux/amd64 | |
- path: 17/jdk/18/alpine | |
tags: "alpine-jdk-18 alpine-jdk-hydrogen 17-alpine-jdk-18 17-alpine-jdk-hydrogen" | |
platforms: linux/amd64 | |
- path: 17/jre/16 | |
tags: "17-16 17-gallium 17-jre-16 17-jre-gallium latest 17 17-jre jre" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 17/jre/18 | |
tags: "17-18 17-hydrogen 17-jre-18 17-jre-hydrogen" | |
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/arm/v7 | |
- path: 17/jre/16/alpine | |
tags: "17-alpine-16 17-alpine-gallium 17-alpine-jre-16 17-alpine-jre-gallium alpine-16 alpine-gallium alpine-jre-16 alpine-jre-gallium 17-alpine 17-alpine-jre alpine alpine-jre" | |
platforms: linux/amd64 | |
- path: 17/jre/18/alpine | |
tags: "17-alpine-18 17-alpine-hydrogen 17-alpine-jre-18 17-alpine-jre-hydrogen alpine-18 alpine-hydrogen alpine-jre-18 alpine-jre-hydrogen" | |
platforms: linux/amd64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Workaround Docker bug in runner | |
run: | | |
sudo rm /etc/docker/daemon.json | |
sudo systemctl restart docker | |
- name: Prepare | |
id: prepare | |
run: | | |
DOCKER_IMAGE=timbru31/java-node | |
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/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
install: true | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Docker Buildx (build) | |
uses: docker/[email protected] | |
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() && github.event_name != 'pull_request' && contains(github.ref, 'master') | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Buildx (push) | |
uses: docker/[email protected] | |
if: success() && github.event_name != 'pull_request' && 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 |