-
-
Notifications
You must be signed in to change notification settings - Fork 101
93 lines (82 loc) · 2.48 KB
/
docker-image-matrix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Runs on PR or Release and only if Dockerfile exists and not docs being updated
name: Docker matrix build & publish
on:
release:
types: [published]
branches:
- main
tags:
# paths-ignore:
# - 'docs/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
docker:
strategy:
matrix:
os: [buster, bullseye, bookworm]
java: [false, true]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
if: ${{ ! matrix.java }}
uses: docker/metadata-action@v5
with:
images: theyosh/terrariumpi
flavor: |
latest=false
suffix=-${{ matrix.os }},onlatest=false
- name: Docker meta - Java
id: metajava
if: ${{ matrix.java }}
uses: docker/metadata-action@v5
with:
images: theyosh/terrariumpi
flavor: |
latest=${{ matrix.os == 'buster' }}
suffix=-${{ matrix.os }}-java,onlatest=false
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: ${{ ! matrix.java }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.${{ matrix.os }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GITHUB_SHA=${{ github.sha }}
- name: Build and push - Java
if: ${{ matrix.java }}
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.${{ matrix.os }}
push: true
tags: ${{ steps.metajava.outputs.tags }}
labels: ${{ steps.metajava.outputs.labels }}
platforms: linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
GITHUB_SHA=${{ github.sha }}
JAVA=default-jre-headless