name: Build and publish multiarch on: push: branches: - master - test/** tags: - "[0-9]+.[0-9]+.[0-9]+" paths-ignore: - "*.md" - "docs/**" - "examples/**" jobs: build: if: github.repository == 'itzg/docker-minecraft-server' strategy: fail-fast: false matrix: variant: - java17 - java17-openj9 - java8-multiarch - java8-openj9 - java11 - java11-openj9 include: - variant: java17 baseImage: eclipse-temurin:17 tagPrefix: java17- platforms: linux/amd64,linux/arm/v7,linux/arm64 mcVersion: LATEST - variant: java17-openj9 baseImage: ibm-semeru-runtimes:open-17-jdk tagPrefix: java17-openj9- platforms: linux/amd64,linux/arm64 mcVersion: LATEST - variant: java8-multiarch baseImage: eclipse-temurin:8-jdk tagPrefix: java8- platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - variant: java8-openj9 baseImage: ibm-semeru-runtimes:open-8-jdk tagPrefix: java8-openj9- platforms: linux/amd64,linux/arm64 mcVersion: 1.12.2 - variant: java11 baseImage: adoptopenjdk:11-jdk-hotspot tagPrefix: java11- platforms: linux/amd64,linux/arm/v7,linux/arm64 mcVersion: 1.16.5 - variant: java11-openj9 baseImage: ibm-semeru-runtimes:open-11-jdk tagPrefix: java11-openj9- platforms: linux/amd64,linux/arm64 mcVersion: 1.16.5 env: IMAGE_TO_TEST: itzg/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }} runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2.4.0 - name: Docker meta id: meta uses: docker/metadata-action@v3 with: images: | itzg/minecraft-server tags: | type=ref,event=tag,enable=${{ matrix.variant == 'java17' }} type=ref,event=tag,prefix=${{ matrix.variant }}- type=raw,value=${{ matrix.variant }} flavor: | latest=${{ matrix.variant == 'java17' }} labels: | org.opencontainers.image.authors=Geoff Bourne - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 - name: Set up QEMU uses: docker/setup-qemu-action@v1.2.0 - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build for test uses: docker/build-push-action@v2.8.0 with: platforms: linux/amd64 tags: ${{ env.IMAGE_TO_TEST }} # ensure latest base image is used pull: true # load into daemon for test usage in next step load: true push: false build-args: | BASE_IMAGE=${{ matrix.baseImage }} cache-from: type=gha,scope=${{ matrix.variant }} # no cache-to to avoid cross-cache update from next build step - name: Run tests env: MINECRAFT_VERSION: ${{ matrix.mcVersion }} run: | tests/test.sh - name: Build and push id: docker_build uses: docker/build-push-action@v2.8.0 with: platforms: ${{ matrix.platforms }} push: ${{ github.ref_name == 'master' }} tags: ${{ steps.meta.outputs.tags }} # ensure latest base image is used pull: true labels: ${{ steps.meta.outputs.labels }} build-args: | BASE_IMAGE=${{ matrix.baseImage }} cache-from: type=gha,scope=${{ matrix.variant }} cache-to: type=gha,mode=max,scope=${{ matrix.variant }}