Skip to content

Commit b6d0f5d

Browse files
feat: update php 8
1 parent ee884d9 commit b6d0f5d

14 files changed

Lines changed: 1668 additions & 0 deletions
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build PHP 8 Security Images
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
concurrency:
10+
group: php8-security-release
11+
cancel-in-progress: false
12+
13+
env:
14+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-24.04
19+
strategy:
20+
fail-fast: false
21+
max-parallel: 1
22+
matrix:
23+
phpVersion: ["8.2.35", "8.3.36", "8.4.27", "8.5.12"]
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
28+
- name: Prepare source build with 1Panel configuration
29+
shell: bash
30+
env:
31+
PHP_VERSION: ${{ matrix.phpVersion }}
32+
run: |
33+
set -euo pipefail
34+
python3 - <<'PY'
35+
import os
36+
import shutil
37+
from pathlib import Path
38+
39+
version = os.environ["PHP_VERSION"]
40+
source = Path("php/8")
41+
context = Path(os.environ["RUNNER_TEMP"]) / "php-security"
42+
context.mkdir()
43+
shutil.copytree(source / "data", context / "data")
44+
for helper in (source / "upstream").glob("docker-php-*"):
45+
shutil.copy2(helper, context / helper.name)
46+
(context / helper.name).chmod(0o755)
47+
48+
upstream = (source / "upstream" / version / "Dockerfile").read_text()
49+
assert upstream.count("FROM debian:trixie-slim\n") == 1
50+
assert f"ENV PHP_VERSION {version}\n" in upstream
51+
assert upstream.count('make -j "$(nproc)"') == 1
52+
upstream = upstream.replace("FROM debian:trixie-slim\n", "FROM debian:trixie-slim AS php-upstream\n", 1)
53+
upstream = upstream.replace('make -j "$(nproc)"', 'make -j 2', 1)
54+
55+
runtime = (source / "Dockerfile").read_text()
56+
base = "ARG PHP_VERSION\nFROM php:${PHP_VERSION}-fpm\n"
57+
assert runtime.startswith(base)
58+
runtime = "FROM php-upstream\n" + runtime[len(base):]
59+
smoke = f"\nRUN php -r 'exit(PHP_VERSION === \"{version}\" ? 0 : 1);' && php-fpm -t && supervisord --version && composer --version\n"
60+
(context / "Dockerfile").write_text(upstream + "\n" + runtime + smoke)
61+
PY
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v4
68+
with:
69+
buildkitd-config-inline: |
70+
[worker.oci]
71+
max-parallelism = 1
72+
73+
- name: Login to Docker Hub
74+
uses: docker/login-action@v4
75+
with:
76+
username: ${{ secrets.DOCKERHUB_USERNAME }}
77+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
78+
79+
- name: Build PHP-FPM security image and push
80+
uses: docker/build-push-action@v7
81+
with:
82+
context: ${{ runner.temp }}/php-security
83+
file: ${{ runner.temp }}/php-security/Dockerfile
84+
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
85+
pull: true
86+
push: true
87+
tags: 1panel/php:${{ matrix.phpVersion }}-fpm
88+
cache-from: type=gha,scope=php-security-${{ matrix.phpVersion }}
89+
cache-to: type=gha,mode=max,scope=php-security-${{ matrix.phpVersion }}

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Current images in this repository:
2626
- `1panel/php`: PHP-FPM runtime images for multiple versions
2727
- `1panel/java`: Java JDK runtime images based on Eclipse Temurin
2828

29+
## PHP 8 security releases
30+
31+
`Build PHP 8 Security Images` builds PHP 8.2.35, 8.3.36, 8.4.27 and 8.5.12 from pinned upstream Dockerfiles, without waiting for official base image tags. See [source provenance and build instructions](php/8/upstream/README.md).
32+
2933
## PHP 7.3 / 7.4
3034

3135
The `Build PHP 7 Image` workflow (`.github/workflows/php7-release.yml`) builds PHP 7.3 and 7.4 from `php/7`, independently of PHP 8. For example:

‎README_zh.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
- `1panel/php`:多个版本的 PHP-FPM 运行环境镜像
2727
- `1panel/java`:基于 Eclipse Temurin 的 Java JDK 运行环境镜像
2828

29+
## PHP 8 安全版本
30+
31+
`Build PHP 8 Security Images` 从固定上游提交的 Dockerfile 构建 PHP 8.2.35、8.3.36、8.4.27 和 8.5.12,不依赖尚未发布的官方基础镜像标签。详见[源码来源和构建说明](php/8/upstream/README.md)。
32+
2933
## PHP 7.3 / 7.4
3034

3135
`Build PHP 7 Image` 工作流(`.github/workflows/php7-release.yml`)从 `php/7` 构建 PHP 7.3 和 7.4,与 PHP 8 分开维护。例如:

0 commit comments

Comments
 (0)