Ephemeral self-hosted GitHub Actions runner with PHP 8.3-8.5, Composer and Node.
352
Self-hosted GitHub Actions runner for PHP and Laravel CI. It's built on Ubuntu 24.04 and includes PHP (8.3, 8.4 or 8.5), Composer, Node, git and the system libraries Playwright's Chromium needs.
php-<version> label is always added.linux/amd64 and linux/arm64.docker run -d --restart always \
-e REPO=my-org \
-e ACCESS_TOKEN=ghp_xxx \
-e NAME=runner-1 \
rhuruphansen/php-github-runner:8.4
--restart always (or restart: always in Compose) is required in ephemeral mode. Without it the container stops after the first job. See docker-compose.example.yml for several runners plus MySQL and Mailpit for tests.
In a workflow:
jobs:
test:
runs-on: [self-hosted, php-8.4]
The images are published to Docker Hub as rhuruphansen/php-github-runner and to GHCR as ghcr.io/rhurup/php-github-runner.
| Tag | |
|---|---|
8.3, 8.4, 8.5 | Latest weekly build of that PHP version |
8.4-20261019 | Fixed build (date-stamped) |
latest | Same as 8.4 |
rhuruphansen/github-runner is the image's old name. It gets the same tags, so existing setups keep updating.
| Variable | Default | |
|---|---|---|
REPO | required | Org name (my-org) for an org runner, or owner/repo for a repo runner |
ACCESS_TOKEN | – | PAT used to fetch a registration token at every start (recommended, see below) |
REG_TOKEN | – | Pre-generated registration token. Only used without ACCESS_TOKEN. Expires after about 1 hour |
NAME | hostname | Runner name in GitHub |
LABELS | – | Extra comma-separated labels. php-<version> is always added |
RUNNER_GROUP | – | Runner group (org runners) |
RUNNER_EPHEMERAL | true | false keeps the runner and its files between jobs. Faster, because caches survive, but jobs can affect each other |
The PAT needs one of these:
| Runner | Classic PAT | Fine-grained PAT |
|---|---|---|
| Org | admin:org | Organization permission Self-hosted runners: Read and write |
| Repo | repo | Repository permission Administration: Read and write |
Use a fine-grained token limited to what's needed, or a dedicated machine user. The token never reaches jobs, but it's still a powerful credential on the host.
npx playwright install chromium in the job. In ephemeral mode, cache ~/.cache/ms-playwright with actions/cache.actions/cache or actions/setup-node caching.docker build --build-arg PHP_VERSION=8.5 -t php-github-runner:8.5 .
Build args: PHP_VERSION, PHP_EXTENSIONS, RUNNER_VERSION, NODE_VERSION (default 24), RUNNER_UID (default 1001).
Content type
Image
Digest
sha256:b9206b90f…
Size
612.8 MB
Last updated
about 10 hours ago
docker pull rhuruphansen/php-github-runner