2021-02-06 20:52:20 +00:00
|
|
|
name: Build and publish multiarch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-05-21 12:46:49 +00:00
|
|
|
- master
|
2021-05-21 22:28:25 +00:00
|
|
|
- "*-multiarch"
|
|
|
|
- "multiarch*"
|
2021-05-22 03:34:45 +00:00
|
|
|
- java8-openj9
|
|
|
|
- java11*
|
2021-05-21 21:45:33 +00:00
|
|
|
- java16*
|
2021-02-06 20:52:20 +00:00
|
|
|
- test/multiarch/*
|
|
|
|
tags:
|
2021-05-21 12:39:59 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
2021-05-21 22:32:38 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch*"
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-*multiarch"
|
2021-05-22 03:34:45 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-java8-openj9"
|
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-java11*"
|
2021-05-21 21:45:33 +00:00
|
|
|
- "[0-9]+.[0-9]+.[0-9]+-java16*"
|
2021-05-01 22:39:35 +00:00
|
|
|
paths-ignore:
|
|
|
|
- "*.md"
|
2021-05-02 23:31:08 +00:00
|
|
|
- "docs/**"
|
|
|
|
- "examples/**"
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker-buildx:
|
2021-06-24 02:20:37 +00:00
|
|
|
if: github.repository == 'itzg/docker-minecraft-server'
|
2021-02-06 20:52:20 +00:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2021-05-14 01:45:43 +00:00
|
|
|
uses: actions/checkout@v2.3.4
|
2021-02-06 20:52:20 +00:00
|
|
|
|
2021-05-14 22:48:17 +00:00
|
|
|
- name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
itzg/minecraft-server
|
|
|
|
tags: |
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
2021-05-22 04:00:27 +00:00
|
|
|
flavor: |
|
2021-07-03 19:16:10 +00:00
|
|
|
latest=${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Setup Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Cache Docker layers
|
2021-05-31 13:03:12 +00:00
|
|
|
uses: actions/cache@v2.1.6
|
2021-02-06 20:52:20 +00:00
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
2021-07-02 20:46:40 +00:00
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
2021-02-06 20:52:20 +00:00
|
|
|
restore-keys: |
|
2021-05-21 22:04:11 +00:00
|
|
|
${{ runner.os }}-buildx-
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU
|
2021-05-31 13:02:39 +00:00
|
|
|
uses: docker/setup-qemu-action@v1.2.0
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build and push
|
|
|
|
id: docker_build
|
2021-07-05 12:09:06 +00:00
|
|
|
uses: docker/build-push-action@v2.6.1
|
2021-02-06 20:52:20 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-05-14 22:48:17 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
2021-02-09 03:27:25 +00:00
|
|
|
# ensure latest base image is used
|
|
|
|
pull: true
|
2021-02-06 20:52:20 +00:00
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2021-07-02 20:46:40 +00:00
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new
|
2021-05-14 22:48:17 +00:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2021-02-06 20:52:20 +00:00
|
|
|
|
|
|
|
- name: Image digest
|
|
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
2021-07-02 20:46:40 +00:00
|
|
|
|
|
|
|
- # Temp fix
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
name: Move cache
|
|
|
|
run: |
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|