Skip to content

Commit 18a078d

Browse files
committed
feat: switch to docker bake action
Repository now uses docker bake github action together with docker-bake.hcl style: various fixes in yaml files feat: added php 8.3 support feat: separate workflow for image testing
1 parent 4c0619b commit 18a078d

17 files changed

+288
-127
lines changed

CODE_OF_CONDUCT.md renamed to .github/CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
lotyp7@gmail.com.
63+
the@wayof.dev.
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the

.github/labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
"type: documentation":
77
- changed-files:
8-
- any-glob-to-any-file: [ 'assets/**/*', '.github/*', './*.md' ]
8+
- any-glob-to-any-file: ['assets/**/*', '.github/*.yml', './*.md']
99

1010
"type: maintenance":
1111
- changed-files:
12-
- any-glob-to-any-file: [ '.github/workflows/*' ]
12+
- any-glob-to-any-file: ['.github/workflows/*']
1313

1414
...

.github/workflows/build-latest.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/build-release.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/shellcheck.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22

3+
concurrency:
4+
group: "${{ github.workflow }}-${{ github.ref }}"
5+
cancel-in-progress: true
6+
37
on: # yamllint disable-line rule:truthy
48
pull_request:
59

.github/workflows/test.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
3+
concurrency:
4+
group: "${{ github.workflow }}-${{ github.ref }}"
5+
cancel-in-progress: true
6+
7+
on: # yamllint disable-line rule:truthy
8+
pull_request:
9+
paths-ignore:
10+
- '**.md'
11+
12+
env:
13+
DOCKER_NAMESPACE: wayofdev/php-dev
14+
GHCR_NAMESPACE: ghcr.io/wayofdev/docker-php-dev
15+
16+
name: 🧪 Test Docker images
17+
18+
jobs:
19+
test:
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os_name: ["alpine"]
24+
php_version: ["8.1", "8.2", "8.3"]
25+
php_type: ["fpm", "cli", "supervisord"]
26+
builder: [{arch: "amd64", os: "ubuntu-latest"}]
27+
runs-on: ${{ matrix.builder.os }}
28+
steps:
29+
30+
- name: 🌎 Set environment variables
31+
run: |
32+
php_version="${{ matrix.php_version }}"
33+
tag="${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-${{ matrix.builder.arch }}"
34+
php_version_slug="${php_version//./}"
35+
target="php-${php_version_slug}-${{ matrix.php_type }}-${{ matrix.os_name }}"
36+
echo "TARGET=${target}" >> $GITHUB_ENV
37+
echo "PLATFORM_CACHE_TAG=${tag}" >> $GITHUB_ENV
38+
39+
- name: 📦 Check out the codebase
40+
uses: actions/checkout@v4.1.1
41+
42+
- name: 🛠️ Install goss and dgoss
43+
uses: e1himself/goss-installation-action@v1.2.1
44+
with:
45+
version: v0.4.6
46+
47+
- name: 🤖 Generate dist files
48+
run: ansible-playbook src/playbook.yml -l ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
49+
50+
- name: 🖥️ Setup docker QEMU
51+
uses: docker/setup-qemu-action@v3
52+
53+
- name: 🛠️ Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
with:
56+
buildkitd-flags: "--debug"
57+
58+
- name: 🔑 Login to docker-hub
59+
uses: docker/login-action@v3
60+
with:
61+
username: ${{ secrets.DOCKER_USERNAME }}
62+
password: ${{ secrets.DOCKER_TOKEN }}
63+
64+
- name: 🔑 Login to GHCR
65+
uses: docker/login-action@v3
66+
with:
67+
registry: ghcr.io
68+
username: ${{ github.repository_owner }}
69+
password: ${{ secrets.GITHUB_TOKEN }}
70+
71+
- name: 🐳 Extract docker meta data
72+
id: meta
73+
uses: docker/metadata-action@v5
74+
with:
75+
images: |
76+
${{ env.DOCKER_NAMESPACE }}
77+
${{ env.GHCR_NAMESPACE }}
78+
tags: |
79+
type=raw,event=branch,value=latest
80+
type=ref,event=pr
81+
type=semver,pattern={{version}}
82+
type=semver,pattern={{major}}.{{minor}}
83+
flavor: |
84+
latest=false
85+
prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-
86+
87+
- name: 🧪 Bake image for testing
88+
id: bake
89+
uses: docker/bake-action@v4
90+
with:
91+
targets: ${{ env.TARGET }}
92+
files: |
93+
./docker-bake.hcl
94+
${{ steps.meta.outputs.bake-file }}
95+
set: |
96+
*.tags=
97+
*.platform=linux/${{ matrix.builder.arch }}
98+
*.cache-from=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
99+
*.cache-to=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }}
100+
*.output=type=docker,"name=${{ env.DOCKER_NAMESPACE }},${{ env.GHCR_NAMESPACE }}",name-canonical=true,push=false
101+
102+
- name: 🧪 Test Docker image
103+
run: |
104+
export IMAGE_TEMPLATE=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}
105+
export IMAGE_TAG=${{ env.DOCKER_NAMESPACE }}:latest
106+
make test

.github/workflows/upload-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: 📦 Check out the codebase
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v4.1.1
1818

1919
- name: 🚀 Generate dist files
2020
run: make generate

.hadolint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
3+
trustedRegistries:
4+
- docker.io
5+
- "*.gcr.io"
6+
7+
...

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v4.5.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: fix-encoding-pragma
1010

1111
- repo: https://github.com/adrienverge/yamllint
12-
rev: v1.31.0
12+
rev: v1.35.1
1313
hooks:
1414
- id: yamllint
1515
files: \.(yaml|yml)$
1616
types: [file, yaml]
1717
entry: yamllint --strict
1818

1919
- repo: https://github.com/commitizen-tools/commitizen
20-
rev: 3.2.2
20+
rev: v3.21.3
2121
hooks:
2222
- id: commitizen
2323
stages:
2424
- commit-msg
2525

2626
- repo: https://github.com/ansible/ansible-lint
27-
rev: v6.16.0
27+
rev: v24.2.1
2828
hooks:
2929
- id: ansible-lint
3030
entry: ansible-lint . --force-color

.yamllint

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ rules:
4747
require-starting-space: true
4848
min-spaces-from-content: 1
4949

50-
line-length:
51-
max: 180
52-
level: warning
50+
line-length: disable
5351

5452
yaml-files:
5553
- "*.yaml"

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,7 @@ lint-docker: ## Run hadolint linter over dist Dockerfiles
137137
hadolint -V ./dist/dev/8.2-cli-alpine/Dockerfile
138138
hadolint -V ./dist/dev/8.2-fpm-alpine/Dockerfile
139139
hadolint -V ./dist/dev/8.2-fpm-supervisord/Dockerfile
140+
hadolint -V ./dist/dev/8.3-cli-alpine/Dockerfile
141+
hadolint -V ./dist/dev/8.3-fpm-alpine/Dockerfile
142+
hadolint -V ./dist/dev/8.3-fpm-supervisord/Dockerfile
140143
.PHONY: lint-docker

README.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<img width="456" src="https://raw.githubusercontent.com/wayofdev/docker-php-dev/master/assets/logo.gh-light-mode-only.png#gh-light-mode-only">
55
<img width="456" src="https://raw.githubusercontent.com/wayofdev/docker-php-dev/master/assets/logo.gh-dark-mode-only.png#gh-dark-mode-only">
66
</div>
7-
87
<br>
98

109
<br>
@@ -124,18 +123,15 @@ $ make
124123
Building all images:
125124

126125
```bash
127-
$ make build IMAGE_TEMPLATE="7.4-cli-alpine"
128-
$ make build IMAGE_TEMPLATE="7.4-fpm-alpine"
129-
$ make build IMAGE_TEMPLATE="7.4-supervisord-alpine"
130-
$ make build IMAGE_TEMPLATE="8.0-cli-alpine"
131-
$ make build IMAGE_TEMPLATE="8.0-fpm-alpine"
132-
$ make build IMAGE_TEMPLATE="8.0-supervisord-alpine"
133126
$ make build IMAGE_TEMPLATE="8.1-cli-alpine"
134127
$ make build IMAGE_TEMPLATE="8.1-fpm-alpine"
135128
$ make build IMAGE_TEMPLATE="8.1-supervisord-alpine"
136129
$ make build IMAGE_TEMPLATE="8.2-cli-alpine"
137130
$ make build IMAGE_TEMPLATE="8.2-fpm-alpine"
138131
$ make build IMAGE_TEMPLATE="8.2-supervisord-alpine"
132+
$ make build IMAGE_TEMPLATE="8.3-cli-alpine"
133+
$ make build IMAGE_TEMPLATE="8.3-fpm-alpine"
134+
$ make build IMAGE_TEMPLATE="8.3-supervisord-alpine"
139135
```
140136

141137
<br>
@@ -153,18 +149,15 @@ $ make test
153149
To test all images:
154150

155151
```bash
156-
$ make test IMAGE_TEMPLATE="7.4-cli-alpine"
157-
$ make test IMAGE_TEMPLATE="7.4-fpm-alpine"
158-
$ make test IMAGE_TEMPLATE="7.4-supervisord-alpine"
159-
$ make test IMAGE_TEMPLATE="8.0-cli-alpine"
160-
$ make test IMAGE_TEMPLATE="8.0-fpm-alpine"
161-
$ make test IMAGE_TEMPLATE="8.0-supervisord-alpine"
162152
$ make test IMAGE_TEMPLATE="8.1-cli-alpine"
163153
$ make test IMAGE_TEMPLATE="8.1-fpm-alpine"
164154
$ make test IMAGE_TEMPLATE="8.1-supervisord-alpine"
165155
$ make test IMAGE_TEMPLATE="8.2-cli-alpine"
166156
$ make test IMAGE_TEMPLATE="8.2-fpm-alpine"
167157
$ make test IMAGE_TEMPLATE="8.2-supervisord-alpine"
158+
$ make test IMAGE_TEMPLATE="8.3-cli-alpine"
159+
$ make test IMAGE_TEMPLATE="8.3-fpm-alpine"
160+
$ make test IMAGE_TEMPLATE="8.3-supervisord-alpine"
168161
```
169162

170163
<br>
@@ -189,6 +182,12 @@ Run ansible-lint to validate project files:
189182
$ make lint-ansible
190183
```
191184

185+
Run [dive](https://github.com/wagoodman/dive) command to analyze image:
186+
187+
```bash
188+
$ make analyze
189+
```
190+
192191
<br>
193192

194193
## 🤝 License
@@ -207,9 +206,4 @@ This repository was created in **2022** by [lotyp / wayofdev](https://github.com
207206

208207
<img align="left" src="https://img.shields.io/github/contributors-anon/wayofdev/docker-php-dev?style=for-the-badge"/>
209208

210-
<a href="https://github.com/wayofdev/docker-php-dev/graphs/contributors">
211-
<img src="https://opencollective.com/wod/contributors.svg?width=890&button=false">
212-
</a>
213-
214209
<br>
215-

0 commit comments

Comments
 (0)