Skip to content

jorge07/alpine-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

360 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alpine PHP

All Contributors

PR checks Docker Pulls Docker Hub GHCR

Lightweight PHP-FPM Docker images based on Alpine Linux — under 40MB.

Kept up to date with active PHP releases. Weekly automated rebuilds pick up Alpine security patches.


Images

Tag PHP Alpine Arch
8.4 / 8.4-dev 8.4.x edge amd64, arm64, arm/v7, arm/v8
8.3 / 8.3-dev 8.3.x 3.20 amd64, arm64, arm/v7, arm/v8
8.2 / 8.2-dev 8.2.x 3.21 amd64, arm64, arm/v7, arm/v8
8.1 / 8.1-dev 8.1.x 3.19 amd64, arm64, arm/v7, arm/v8

Available on Docker Hub and GHCR.

Deprecated (available but unmaintained)

8.0 · 7.4 · 7.3 · 7.2 · 7.1 · 5.6


Quick start

# Production image — PHP-FPM on port 9000
docker run -d --name php -p 9000:9000 -v $PWD:/app jorge07/alpine-php:8.3

# Dev image — PHP-FPM + Xdebug + Composer + SSH
docker run -d --name php-dev \
  -p 2244:22 \
  -p 9003:9003 \
  -v $PWD:/app \
  jorge07/alpine-php:8.3-dev

Dev Container (VS Code)

The repo ships a .devcontainer/devcontainer.json for use with VS Code Dev Containers or GitHub Codespaces.

Get started in 3 steps

  1. Install the Dev Containers extension in VS Code
  2. Open your project folder
  3. Click Reopen in Container (or run Dev Containers: Reopen in Container from the command palette)

VS Code will pull jorge07/alpine-php:8.3-dev, mount your project at /app, and pre-install:

Xdebug launch config

Add .vscode/launch.json to your project:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/app": "${workspaceFolder}"
            }
        }
    ]
}

Set breakpoints, press F5, and trigger a request. For CLI scripts:

docker exec php-dev sh -c "XDEBUG_SESSION=1 php /app/script.php"

Dev images — manual setup

Dev images add Xdebug, Composer, SSH, and Supervisor on top of the production image.

PHPStorm (SSH remote interpreter)

docker run -d --name php-dev -p 2244:22 -p 9003:9003 -v $PWD:/app jorge07/alpine-php:8.3-dev

Languages & Frameworks → PHP → Add → SSH Credentials

Field Value
Host localhost
Port 2244
User root
Password root
PHP executable /usr/bin/php

Path mappings: <project root>/app

Debug → Xdebug port: 9003

Custom SSH credentials

docker build \
  --build-arg USER=myuser \
  --build-arg PASSWORD=mypass \
  --target dev -t myapp:dev \
  -f 8.3/Dockerfile 8.3/

Xdebug 3 — key settings

Setting Value
Port 9003 (changed from 9000 in Xdebug 2)
Trigger XDEBUG_SESSION=1 env var
Mode debug (set in image, trigger-based)

Migrating from Xdebug 2? See the IDE integration guide for a full comparison table and PHPStorm setup walkthrough.


PHP Extensions

All images include:

bcmath · ctype · curl · dom · exif · fileinfo · gd · iconv · intl · mbstring · opcache · openssl · pcntl · pdo · pdo_mysql · pdo_pgsql · phar · session · simplexml · sodium · tokenizer · xml · xmlreader · xsl · zip · zlib · apcu

Dev images additionally include: xdebug · pear


Contributors ✨

Thanks goes to these wonderful people (emoji key):


Kajetan

💻

Luis

💻

Krzysztof Kowalski

💻

Ismael

💻

This project follows the all-contributors specification. Contributions of any kind welcome!