-
Notifications
You must be signed in to change notification settings - Fork 54
137 lines (121 loc) · 4.06 KB
/
docker-build.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: build-all-containers
on:
pull_request:
push:
branches: [ master ]
# Allow workflow to be manually run from the GitHub UI
workflow_dispatch:
# Daily build
schedule:
- cron: "0 2 * * *"
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: php74
folder: php/7.4
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ]
targets:
primary:
name: cli
tags: phpdockerio/php:7.4-cli,phpdockerio/php74-cli:latest
secondary:
name: fpm
tags: phpdockerio/php:7.4-fpm,phpdockerio/php74-fpm:latest
tertiary:
name: swoole
tags: phpdockerio/php74-swoole:latest
- name: php80
folder: php/8.0
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ]
targets:
primary:
name: cli
tags: phpdockerio/php:8.0-cli,phpdockerio/php80-cli:latest
secondary:
name: fpm
tags: phpdockerio/php:8.0-fpm,phpdockerio/php80-fpm:latest
tertiary:
name: swoole
tags: phpdockerio/php80-swoole:latest
- name: php81
folder: php/8.1
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ]
targets:
primary:
name: cli
tags: phpdockerio/php:8.1-cli
secondary:
name: fpm
tags: phpdockerio/php:8.1-fpm
tertiary: ~
- name: php82
folder: php/8.2
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ]
targets:
primary:
name: cli
tags: phpdockerio/php:8.2-cli
secondary:
name: fpm
tags: phpdockerio/php:8.2-fpm
tertiary: ~
- name: php83
folder: php/8.3
arch: [ linux/amd64, linux/arm64, linux/arm/v7 ]
targets:
primary:
name: cli
tags: phpdockerio/php:8.3-cli
secondary:
name: fpm
tags: phpdockerio/php:8.3-fpm
tertiary: ~
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Debug
run: |
echo "is_master: -> ${{ github.ref == 'refs/heads/master' }} <-"
echo "ref: ${{ github.head_ref }}"
- name: Set up QEMU (required for arm build)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Primary container
uses: docker/build-push-action@v5
with:
context: ${{ matrix.folder }}
platforms: ${{ join(matrix.arch, ',') }}
push: ${{ github.ref == 'refs/heads/master' }}
pull: true
tags: ${{ matrix.targets.primary.tags }}
target: ${{ matrix.targets.primary.name }}
- name: Secondary container
if: matrix.targets.secondary
uses: docker/build-push-action@v5
with:
context: ${{ matrix.folder }}
platforms: ${{ join(matrix.arch, ',') }}
push: ${{ github.ref == 'refs/heads/master' }}
pull: true
tags: ${{ matrix.targets.secondary.tags }}
target: ${{ matrix.targets.secondary.name }}
- name: Tertiary container
if: matrix.targets.tertiary
uses: docker/build-push-action@v5
with:
context: ${{ matrix.folder }}
platforms: ${{ join(matrix.arch, ',') }}
push: ${{ github.ref == 'refs/heads/master' }}
pull: true
tags: ${{ matrix.targets.tertiary.tags }}
target: ${{ matrix.targets.tertiary.name }}