-
-
Notifications
You must be signed in to change notification settings - Fork 17
117 lines (97 loc) · 3.35 KB
/
buildx.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: buildx
on:
schedule:
- cron: "37 07 * * *"
pull_request:
push:
branches:
- master
jobs:
buildx:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker-file:
- path: 18
tags: "18 hydrogen"
platforms: linux/amd64,linux/arm64
- path: 18/slim
tags: "18-slim hydrogen-slim"
platforms: linux/amd64,linux/arm64
- path: 18/alpine
tags: "18-alpine hydrogen-alpine"
platforms: linux/amd64,linux/arm64
- path: 20
tags: "20 iron latest"
platforms: linux/amd64,linux/arm64
- path: 20/slim
tags: "20-slim iron-slim slim"
platforms: linux/amd64,linux/arm64
- path: 20/alpine
tags: "20-alpine iron-alpine alpine"
platforms: linux/amd64,linux/arm64
steps:
- name: Checkout
uses: actions/[email protected]
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=timbru31/node-chrome
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() && 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() && 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