Repository navigation
91 lines (78 loc) · 3.12 KB
/
Copy pathphp8-security-release.yml
File metadata and controls
91 lines (78 loc) · 3.12 KB
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 PHP 8 Security Images
run-name: Build PHP 8 Security Images 8.2.35, 8.3.36, 8.4.27, 8.5.12
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: php8-security-release
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
docker:
name: Build PHP Image ${{ matrix.phpVersion }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
max-parallel: 1
matrix:
phpVersion: ["8.2.35", "8.3.36", "8.4.27", "8.5.12"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Prepare source build with 1Panel configuration
shell: bash
env:
PHP_VERSION: ${{ matrix.phpVersion }}
run: |
set -euo pipefail
python3 - <<'PY'
import os
import shutil
from pathlib import Path
version = os.environ["PHP_VERSION"]
source = Path("php/8")
context = Path(os.environ["RUNNER_TEMP"]) / "php-security"
context.mkdir()
shutil.copytree(source / "data", context / "data")
for helper in (source / "upstream").glob("docker-php-*"):
shutil.copy2(helper, context / helper.name)
(context / helper.name).chmod(0o755)
upstream = (source / "upstream" / version / "Dockerfile").read_text()
assert upstream.count("FROM debian:trixie-slim\n") == 1
assert f"ENV PHP_VERSION {version}\n" in upstream
assert upstream.count('make -j "$(nproc)"') == 1
upstream = upstream.replace("FROM debian:trixie-slim\n", "FROM debian:trixie-slim AS php-upstream\n", 1)
upstream = upstream.replace('make -j "$(nproc)"', 'make -j 2', 1)
runtime = (source / "Dockerfile").read_text()
base = "ARG PHP_VERSION\nFROM php:${PHP_VERSION}-fpm\n"
assert runtime.startswith(base)
runtime = "FROM php-upstream\n" + runtime[len(base):]
smoke = f"\nRUN php -r 'exit(PHP_VERSION === \"{version}\" ? 0 : 1);' && php-fpm -t && supervisord --version && composer --version\n"
(context / "Dockerfile").write_text(upstream + "\n" + runtime + smoke)
PY
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 1
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build PHP-FPM security image and push
uses: docker/build-push-action@v7
with:
context: ${{ runner.temp }}/php-security
file: ${{ runner.temp }}/php-security/Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
pull: true
push: true
tags: 1panel/php:${{ matrix.phpVersion }}-fpm
cache-from: type=gha,scope=php-security-${{ matrix.phpVersion }}
cache-to: type=gha,mode=max,scope=php-security-${{ matrix.phpVersion }}