Skip to content

Commit 150730e

Browse files
authored
Merge pull request #1 from Ilyes512/inital
Initial setup
2 parents cd94110 + fffdfbc commit 150730e

14 files changed

+746
-3
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!/files

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[{*,*.dist}.{yml,yaml}]
15+
indent_size = 2

.github/dependabot.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# For all configuration options:
2+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: docker
7+
directory: "fpm"
8+
schedule:
9+
interval: "daily"
10+
ignore:
11+
- dependency-name: '*'
12+
update-types: ["version-update:semver-major", "version-update:semver-minor"]
13+
- package-ecosystem: docker
14+
directory: "apache"
15+
schedule:
16+
interval: "daily"
17+
ignore:
18+
- dependency-name: '*'
19+
update-types: ["version-update:semver-major", "version-update:semver-minor"]
20+
- package-ecosystem: "github-actions"
21+
directory: "/"
22+
schedule:
23+
interval: "daily"

.github/workflows/main.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
actions: write
9+
packages: write
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
uses: Ilyes512/github-actions/.github/workflows/build-php.yml@0.4.0
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
platform:
23+
- linux/amd64
24+
- linux/arm64
25+
docker:
26+
- dockerfile: fpm/Dockerfile
27+
image-name: ghcr.io/${{ github.repository }}
28+
key: fpm
29+
- dockerfile: apache/Dockerfile
30+
image-name: ghcr.io/${{ github.repository }}/apache
31+
key: apache
32+
with:
33+
runs-on: ubuntu-24.04
34+
platform: ${{ matrix.platform }}
35+
image-name: ${{ matrix.docker.image-name }}
36+
dockerfile: ${{ matrix.docker.dockerfile }}
37+
cache-key: ${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-${{ github.ref_name }}-${{ github.sha }}
38+
cache-restore-keys: |
39+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-${{ github.ref_name }}-
40+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}
41+
42+
merge:
43+
uses: Ilyes512/github-actions/.github/workflows/merge-php.yml@0.4.0
44+
needs: build
45+
strategy:
46+
matrix:
47+
image-name:
48+
- ghcr.io/${{ github.repository }}
49+
- ghcr.io/${{ github.repository }}/apache
50+
with:
51+
runs-on: ubuntu-24.04
52+
image-name: ${{ matrix.image-name }}

.github/workflows/pr.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Pull Requests
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
actions: write
8+
packages: write
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build:
17+
uses: Ilyes512/github-actions/.github/workflows/build-php.yml@0.4.0
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
platform:
22+
- linux/amd64
23+
- linux/arm64
24+
docker:
25+
- dockerfile: fpm/Dockerfile
26+
image-name: ghcr.io/${{ github.repository }}
27+
key: fpm
28+
- dockerfile: apache/Dockerfile
29+
image-name: ghcr.io/${{ github.repository }}/apache
30+
key: apache
31+
with:
32+
runs-on: ubuntu-24.04
33+
platform: ${{ matrix.platform }}
34+
image-name: ${{ matrix.docker.image-name }}
35+
dockerfile: ${{ matrix.docker.dockerfile }}
36+
cache-key: ${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-pr-${{ github.event.number }}-${{ github.sha }}
37+
cache-restore-keys: |
38+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-pr-${{ github.event.number }}-
39+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-pr-
40+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-main-
41+
42+
merge:
43+
uses: Ilyes512/github-actions/.github/workflows/merge-php.yml@0.4.0
44+
needs: build
45+
strategy:
46+
matrix:
47+
image-name:
48+
- ghcr.io/${{ github.repository }}
49+
- ghcr.io/${{ github.repository }}/apache
50+
with:
51+
runs-on: ubuntu-24.04
52+
image-name: ${{ matrix.image-name }}

.github/workflows/tag.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Tags
2+
3+
on:
4+
push:
5+
tags: ['*']
6+
7+
permissions:
8+
actions: write
9+
packages: write
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
uses: Ilyes512/github-actions/.github/workflows/build-php.yml@0.4.0
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
platform:
23+
- linux/amd64
24+
- linux/arm64
25+
docker:
26+
- dockerfile: fpm/Dockerfile
27+
image-name: ghcr.io/${{ github.repository }}
28+
key: fpm
29+
- dockerfile: apache/Dockerfile
30+
image-name: ghcr.io/${{ github.repository }}/apache
31+
key: apache
32+
with:
33+
runs-on: ubuntu-24.04
34+
platform: ${{ matrix.platform }}
35+
image-name: ${{ matrix.docker.image-name }}
36+
dockerfile: ${{ matrix.docker.dockerfile }}
37+
cache-key: ${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-${{ github.ref_name }}-${{ github.sha }}
38+
cache-restore-keys: |
39+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-${{ github.ref_name }}-
40+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-main-
41+
${{ matrix.os }}-buildx-${{ matrix.platform }}-${{ matrix.docker.key }}-
42+
43+
merge:
44+
uses: Ilyes512/github-actions/.github/workflows/merge-php.yml@0.4.0
45+
needs: build
46+
strategy:
47+
matrix:
48+
image-name:
49+
- ghcr.io/${{ github.repository }}
50+
- ghcr.io/${{ github.repository }}/apache
51+
with:
52+
runs-on: ubuntu-24.04
53+
image-name: ${{ matrix.image-name }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
dev
3+
Taskfile.yml

.hadolint.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ignored:
2+
- SC2086
3+
- DL3008

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Ilyes Ahidar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ A PHP 8.4 (FPM and Apache) based Docker base image.
99
```
1010
docker pull ghcr.io/ilyes512/php84:runtime-latest
1111
docker pull ghcr.io/ilyes512/php84:builder-latest
12-
docker pull ghcr.io/ilyes512/php84:builder-nodejs-latest
12+
docker pull ghcr.io/ilyes512/php84:builder_nodejs-latest
1313
1414
docker pull ghcr.io/ilyes512/php84/apache:runtime-latest
1515
docker pull ghcr.io/ilyes512/php84/apache:builder-latest
16-
docker pull ghcr.io/ilyes512/php84/apache:builder-nodejs-latest
16+
docker pull ghcr.io/ilyes512/php84/apache:builder_nodejs-latest
1717
```
1818

1919
The tag scheme: `{TARGET}-{VERSION}`
@@ -44,7 +44,7 @@ docker build --tag ghcr.io/ilyes512/php84:builder-latest --file fpm/Dockerfile -
4444
Building `builder_nodejs`-target:
4545

4646
```
47-
docker build --tag ghcr.io/ilyes512/php84:builder-nodejs-latest --file fpm/Dockerfile --target builder_nodejs .
47+
docker build --tag ghcr.io/ilyes512/php84:builder_nodejs-latest --file fpm/Dockerfile --target builder_nodejs .
4848
```
4949

5050
## Task commands

Taskfile.dist.yml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
version: "3"
2+
3+
vars:
4+
DOCKER_REPO: ghcr.io
5+
DOCKER_OWNER: ilyes512
6+
# Latatest version of Hadolint: https://hub.docker.com/r/hadolint/hadolint/tags or https://github.com/hadolint/hadolint/releases
7+
HADOLINT_TAG_VERSION: v2.12.0
8+
9+
# env:
10+
# BUILDKIT_PROGRESS: plain
11+
12+
silent: true
13+
14+
tasks:
15+
16+
build:
17+
desc: Build all PHP Docker image targets of both the FPM and Apache variants
18+
cmds:
19+
- task: build:fpm
20+
- task: build:apache
21+
22+
build:fpm:
23+
desc: Build all PHP Docker image targets of the FPM variant
24+
deps: [lint:fpm]
25+
vars:
26+
DOCKER_IMAGE_NAME: php84
27+
DOCKER_FILE_PATH: ./fpm/Dockerfile
28+
cmds:
29+
- task: build:target
30+
vars:
31+
TARGET: runtime
32+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
33+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
34+
- task: build:target
35+
vars:
36+
TARGET: builder
37+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
38+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
39+
- task: build:target
40+
vars:
41+
TARGET: builder_nodejs
42+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
43+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
44+
45+
build:apache:
46+
desc: Build all PHP Docker image targets of the Apache variant
47+
deps: [lint:apache]
48+
vars:
49+
DOCKER_IMAGE_NAME: php84/apache
50+
DOCKER_FILE_PATH: ./apache/Dockerfile
51+
cmds:
52+
- task: build:target
53+
vars:
54+
TARGET: runtime
55+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
56+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
57+
- task: build:target
58+
vars:
59+
TARGET: builder
60+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
61+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
62+
- task: build:target
63+
vars:
64+
TARGET: builder_nodejs
65+
DOCKER_IMAGE_NAME: '{{.DOCKER_IMAGE_NAME}}'
66+
DOCKER_FILE_PATH: '{{.DOCKER_FILE_PATH}}'
67+
68+
build:target:
69+
preconditions:
70+
- sh: >
71+
test '{{.TARGET}}' = 'runtime'
72+
-o '{{.TARGET}}' = 'builder'
73+
-o '{{.TARGET}}' = 'builder_nodejs'
74+
msg: TARGET needs to contain the Docker TARGET [runtime, builder, builder_nodejs]
75+
vars:
76+
VERSION: '{{.VERSION | default "latest"}}'
77+
cmds:
78+
- docker build
79+
--target {{.TARGET}}
80+
--tag {{.DOCKER_REPO}}/{{.DOCKER_OWNER}}/{{.DOCKER_IMAGE_NAME}}:{{.TARGET}}-{{.VERSION}}
81+
--file {{.DOCKER_FILE_PATH}}
82+
.
83+
requires:
84+
vars: [DOCKER_IMAGE_NAME, TARGET, DOCKER_FILE_PATH]
85+
86+
lint:fpm:
87+
desc: Apply a Dockerfile linter (https://github.com/hadolint/hadolint)
88+
cmds:
89+
- task: lint
90+
vars: { DOCKERFILE_PATH: fpm/Dockerfile }
91+
92+
lint:apache:
93+
desc: Apply a Dockerfile linter (https://github.com/hadolint/hadolint)
94+
cmds:
95+
- task: lint
96+
vars: { DOCKERFILE_PATH: apache/Dockerfile }
97+
98+
lint:
99+
cmds:
100+
- docker run
101+
--interactive
102+
--rm
103+
--volume $(pwd)/.hadolint.yml:/.hadolint.yml
104+
hadolint/hadolint:{{.HADOLINT_TAG_VERSION}}
105+
hadolint
106+
-
107+
< {{.DOCKERFILE_PATH}}
108+
requires:
109+
vars: [DOCKERFILE_PATH]
110+
111+
shell:fpm:
112+
desc: Interactive shell
113+
interactive: true
114+
vars:
115+
DOCKER_IMAGE_NAME: php84
116+
cmds:
117+
- docker run
118+
--interactive
119+
--tty
120+
--rm
121+
{{.DOCKER_REPO}}/{{.DOCKER_OWNER}}/{{.DOCKER_IMAGE_NAME}}:builder_nodejs-{{.VERSION | default "latest" }}
122+
bash
123+
124+
shell:apache:
125+
desc: Interactive shell
126+
interactive: true
127+
vars:
128+
DOCKER_IMAGE_NAME: php84/apache
129+
cmds:
130+
- docker run
131+
--interactive
132+
--tty
133+
--rm
134+
{{.DOCKER_REPO}}/{{.DOCKER_OWNER}}/{{.DOCKER_IMAGE_NAME}}:builder_nodejs-{{.VERSION | default "latest" }}
135+
bash

0 commit comments

Comments
 (0)