PHP Docker images for DevPanel — multi-version, multi-variant images covering PHP 7.4 through 8.6 with Apache, ModSecurity, Redis, code-server (VS Code in the browser), Composer, Drush, WP-CLI and more.
- Image variants
- Quick start (users)
- Environment variables
- Contributing
- Testing
- CI / CD
- Agent notes
- Code-server artifact pinning
Each PHP version ships three layered variants.
| Variant | Tag suffix | What it adds |
|---|---|---|
base |
X.Y-base |
PHP + Apache + code-server + Composer + Drush + WP-CLI |
secure |
X.Y-secure |
base + ModSecurity / OWASP Core Rule Set |
advance |
X.Y-advance |
secure + Redis + Supervisor |
Release candidate tags end with -rc (e.g. 8.3-base-rc).
Each image includes the native devpanel CLI built from
devpanel-vn/cli on GitLab
(base/bin/devpanel-${TARGETARCH}). The image build fails when that
binary is not available.
Available PHP versions: 7.4 · 8.0 · 8.1 · 8.2 · 8.3 · 8.4 · 8.5 · 8.6
# Pull the latest stable PHP 8.6 advance image
docker pull devpanel/php:8.6-advance
# Run with code-server enabled on port 8080
docker run -p 80:80 -p 8080:8080 devpanel/php:8.6-advanceOpen http://localhost for the web application and http://localhost:8080
for the browser-based editor.
| Variable | Default | Description |
|---|---|---|
APP_ROOT |
/var/www/html |
Application root directory |
WEB_ROOT |
$APP_ROOT |
Document root for Apache |
PHP_MEMORY_LIMIT |
4096M |
PHP memory_limit |
PHP_MAX_EXECUTION_TIME |
600 |
PHP max_execution_time |
PHP_MAX_INPUT_TIME |
600 |
PHP max_input_time |
PHP_MAX_INPUT_VARS |
3000 |
PHP max_input_vars |
PHP_UPLOAD_MAX_FILESIZE |
64M |
PHP upload_max_filesize |
PHP_POST_MAX_SIZE |
64M |
PHP post_max_size |
PHP_CLEAR_ENV |
false |
PHP-FPM clear_env |
SERVER_NAME |
default |
Apache ServerName |
GIT_BRANCH |
master |
Default Git branch |
CODES_PORT |
8080 |
code-server listen port |
CODES_ENABLE |
yes |
Set to no to disable code-server |
CODES_AUTH |
(unset) | Set to yes to require a password |
<php-version>/
base/ # Base image sources (per-version overlay)
secure/ # Secure image sources (per-version overlay)
advance/ # Advance image sources (per-version overlay)
base/ # Shared base stage sources (common across all versions)
secure/ # Shared secure stage sources
advance/ # Shared advance stage sources
docker-bake.hcl # Docker Bake build matrix
.github/
workflows/ # GitHub Actions CI / build workflows
.githooks/ # Git hooks (activated with ./setup-hooks.sh)
tests/
baselines/ # Stored violation counts for each linter
detect-versions.sh # Shared version-detection script (used by tests and CI)
*.sh # Lint, build, and functional test scripts
compare-baseline.py # Shared baseline-comparison helper
test.sh # Run all checks locally
setup-hooks.sh # Configure Git to use .githooks/ (run once after cloning)
.yamllint.yml # yamllint configuration
-
Copy an existing version directory (e.g.
cp -r 8.3 8.4). -
Update the
FROMline and any version-specific package pins. -
Update
docker-bake.hclif any bake variables need adjusting (the matrix auto-generates build targets for everyX.Y/directory; no per-version workflow files are needed). -
Run
./test.shto make sure there are no new lint or build violations. -
If the new Dockerfiles introduce violations that are intentional or unavoidable, update the baseline:
./test.sh --update-baseline git add tests/baselines/
Run any individual suite with --update-baseline:
bash tests/lint-dockerfile.sh --update-baseline
bash tests/lint-shell.sh --update-baseline
bash tests/lint-yaml.sh --update-baselineOr update all baselines at once:
./test.sh --update-baselineCommit the changed tests/baselines/*.json files together with the code
change that justifies the update.
| Tool | Purpose | Install |
|---|---|---|
shellcheck |
Shell script linting | apt install shellcheck |
yamllint |
YAML linting | pip install yamllint |
docker or hadolint |
Dockerfile linting | docker.com or hadolint releases |
docker |
Docker build tests | docker.com |
./test.sh./test.sh yaml # YAML lint only
./test.sh shell # Shell lint only
./test.sh dockerfile # Dockerfile lint only
./test.sh build # Docker build tests only
./test.sh run # Docker functional (run) tests only
./test.sh build run --version 8.2 # Build and run tests for a single PHP versiontests/build-dockerfile.sh builds every Dockerfile in the repository (without
pushing) to verify the images are buildable. Images are built in dependency
order per PHP version using docker buildx bake:
base → secure (built FROM base) → advance (built FROM secure)
Locally-created test tags are cleaned up by run-dockerfile.sh after
functional tests complete (only the images tested in that invocation are
removed). To remove all devpanel-php-test:* images at once, run:
bash tests/cleanup-test-images.shThe image build copies the committed native binary
base/bin/devpanel-${TARGETARCH}, which update-devpanel-cli.yml builds
from devpanel-vn/cli on GitLab. A
platform whose binary is missing is skipped with a warning.
Build tests take several minutes per PHP version because the images download packages (code-server, composer, etc.). Run a single version during development to keep the feedback loop short:
./test.sh build --version 8.2tests/run-dockerfile.sh starts each built image as a short-lived container
and verifies core tools and extensions are working:
| Variant | Checks |
|---|---|
base |
php --version, PHP code execution, composer --version, apache2 -v, pdo/mbstring extensions |
secure |
All base checks + mod_security2.so present |
advance |
All base checks + redis-cli --version |
Run tests require images built by the build suite. Run both together:
./test.sh build run --version 8.2Tip: Set
DEVPANEL_BUILD_ON_PUSH=1before agit pushto have the pre-push hook also run build and functional tests for any changed Dockerfiles. By default the hook runs lint only (fast); CI always runs the full suite.
Lint checks cover all severities including style warnings. Each baseline
file (tests/baselines/*.json) records the number of times each lint rule
fires per file. A check fails only when the count for any rule/file pair
increases above its baseline value — or when a rule appears in a file
where it was not present before. Reducing violations (improving the code) is
always accepted silently.
This means:
- Existing known violations do not block your push or the CI build.
- Any new violation introduced by your change will block the push and must be fixed (or explicitly added to the baseline with a justification commit).
./setup-hooks.shThis sets core.hooksPath = .githooks in the local Git config so the hooks
in .githooks/ are used directly — no copying needed. The hooks stay in
sync with the repository automatically.
After running setup-hooks.sh, git push will automatically lint only the
files you changed. Set DEVPANEL_BUILD_ON_PUSH=1 to also run Docker build
and functional tests for any changed Dockerfiles.
| Workflow | Trigger | Purpose |
|---|---|---|
test.yml |
push to main/develop; pull_request (any branch) |
Lint, build & functional checks (required) |
docker-build.yml |
push to main or develop; workflow_dispatch |
Detect changed versions and build images |
cache-devpanel-cli.yml |
merged CLI update PR (pull_request_target: closed) |
Record the merged upstream revision in the destination branch cache |
test.yml runs lint, build, and functional tests in parallel. Configure branch protection
rules in GitHub to require the Test workflow checks to pass before pull
requests to main or develop can be merged, ensuring no broken Dockerfile
or script reaches the publish workflows. (Test is the check name shown in the
branch protection UI.) See the
GitHub docs on required status checks
for setup instructions.
| Secret | Description |
|---|---|
DOCKERHUB_USERNAME |
Docker Hub username |
DOCKERHUB_TOKEN |
Docker Hub access token |
- Source files live under both per-version directories (
7.4/,8.0/, …) and shared top-level directories (base/,secure/,advance/). Changes to a shared directory affect all versions; changes underX.Y/affect only that version. Version selection for both local tests and CI is handled bytests/detect-versions.sh. - Lint baselines are stored as JSON in
tests/baselines/. Update them with./test.sh --update-baselinewhenever you make a change that intentionally alters lint counts. - Build tests (
tests/build-dockerfile.sh) try to build every Dockerfile without pushing. Functional tests (tests/run-dockerfile.sh) then start each built image and verify PHP, Apache, Composer, and extensions work. Run./test.sh build run --version <v>to test a single PHP version quickly. - The build workflow is
docker-build.yml, which handles both push-triggered and manual dispatch builds. It runs a detect → build (per-platform, parallel) → merge pipeline. ARM64 builds use nativeubuntu-26.04-armrunners; AMD64 builds useubuntu-26.04. Each image copiesbase/bin/devpanel-${TARGETARCH}and fails when that file is missing. The workflow skips a platform and warns when its native binary is absent. QEMU is set up only for a target platform that has no matching runner. Native AMD64 and ARM64 builds skip QEMU. update-devpanel-cli.ymlrebuilds one lowest-compatiblebase/bin/devpanel-$archbinary per architecture. Itsplatformsinput selects the list; an empty input uses thePLATFORMSrepository variable, orlinux/amd64,linux/arm64when that variable is unset. Variants of one architecture share one binary, and 32-bit ARM is built withGOARM=5so it runs on v5, v6, and v7. Each architecture has its own revision cache key, so a cached architecture is skipped and the others still build. It builds from the latest GitLab CLI repository default branch HEAD. Run it manually on a branch; tags are left unchanged.linux/amd64builds onubuntu-26.04andlinux/arm64builds onubuntu-26.04-arm. A platform without a matching runner is cross-compiled onubuntu-26.04and checked with QEMU. Each build compilescmd/devpanel-clientfor Linux with CGO disabled. This client path is based on the existing binary’s metadata and must be confirmed against the GitLab source. Every build uses the same resolved commit and the Go version from itsgo.mod. The workflow caches each architecture separately after its binary reaches that branch, and skips an architecture on its own cache hit. Delete that architecture’s cache entry to rebuild its binary for the same commit. A new run cancels one already in progress. Set theGITLAB_TOKENrepository secret to a GitLab access token withread_repositoryaccess. The workflow authenticates Git requests with GitLab’soauth2username. The workflow resolves the default-branch HEAD using authenticated Git access, so it does not require GitLab API access. The workflow token commits the binaries. GitLab credentials are scoped to GitLab Git requests and not stored in global Git configuration. The checkout is placed outside this repository, and the selected platforms build in parallel. This workflow does not change which binary the Dockerfile copies into images. If branch protection rejects the direct push, it opens or updates a CLI PR. A later subset for the same revision keeps binaries already on that update branch. If the target branch already has a newer binary for one of those architectures, the rebase merge fails. It finds the PR’s Test run for the generated head SHA, and approves it usingGHCR_TOKEN(a PAT withreposcope). With auto-merge enabled, it requests rebase auto-merge and exits without waiting for tests to finish. It confirms and caches an immediate merge; otherwise it leaves deferred caching tocache-devpanel-cli.yml, which handles merged PR events after the updater exits. With auto-merge disabled, it watches the PR test before merging and saves the revision cache only after confirming the tested commit merged into the target branch. The updater does not rely on a PR event from the workflow token. The cache workflow validates the bot-authored update’s commit metadata and branch name without checking out PR code.- The
advancevariant depends onsecure, which depends onbase. The build chain is enforced via the bake target dependency graph.
base/Dockerfile defines CODESERVER_VERSION (currently 4.99.4) as the default version.
SHA256 checksum verification is always applied during the build.
The CI "Verify code-server .deb hashes" job independently downloads both platform packages and confirms they match the hashes stored in the Dockerfile.
For the pinned hash version, keep both hashes in sync:
CODESERVER_DEB_SHA256_AMD64CODESERVER_DEB_SHA256_ARM64
If you choose to pin another version the same way, compute new hashes with:
VERSION=4.99.4
for arch in amd64 arm64; do
TMPDIR=$(mktemp -d)
curl -fsSL --retry 5 --retry-all-errors --connect-timeout 10 \
"https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_${arch}.deb" \
-o "${TMPDIR}/code-server_${VERSION}_${arch}.deb"
shasum -a 256 "${TMPDIR}/code-server_${VERSION}_${arch}.deb"
rm -rf "${TMPDIR}"
doneThen update CODESERVER_VERSION, CODESERVER_DEB_SHA256_AMD64, and CODESERVER_DEB_SHA256_ARM64 in base/Dockerfile.