-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (78 loc) · 2.62 KB
/
build.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
name: Build Images
on:
push:
env:
REGISTRY: ghcr.io
concurrency:
group: "${{ github.event_name}}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build-images:
name: "Build Docker image"
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
environment: Release
strategy:
matrix:
image:
- path: java/eclipse-temurin
file: alpine.Dockerfile
arg: JAVA_VERSION=8
image: pufferpanel/eclipse-temurin
tags: |
type=raw,value=8-alpine
type=raw,value=8
platform: linux/amd64
- path: java/eclipse-temurin
file: alpine.Dockerfile
arg: JAVA_VERSION=11
image: pufferpanel/eclipse-temurin
tags: |
type=raw,value=11-alpine
type=raw,value=11
platform: linux/amd64
- path: java/eclipse-temurin
file: alpine.Dockerfile
arg: JAVA_VERSION=17
image: pufferpanel/eclipse-temurin
tags: |
type=raw,value=17-alpine
type=raw,value=17
platform: linux/amd64
env:
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Login to DockerHub
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
${{ matrix.image.image }}
tags: |
${{ matrix.image.tags }}
- name: Check out code
uses: actions/checkout@v3
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: ${{ matrix.image.path }}
file: ${{ matrix.image.path }}/${{ matrix.image.file }}
push: ${{ github.event_name != 'pull_request' && env.REGISTRY_USERNAME != '' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
${{ matrix.image.arg }}
platforms: ${{ matrix.image.platform }}