This is a scaffold image of high-performance PHP server using Caddy and php-fpm daemon. It's common image for my internal and external projects as it contains all the PHP server setup and configuration in one place.
The package uses as a base php:8.3-alpine3.19
image, and adds:
- fully-configured Caddy runner with php-fpm daemon
- PHP extensions required by Symfony (
intl
,pdo_mysql
,pdo_pgsql
,redis
,sodium
) - PHP extensions required for maximum application performance (
opcache
,zip
,apcu
) - Composer package manager with cache optimizations (local OS cache is bind)
- php-fpm configuration for maximum performance
- Configured and ready to use Xdebug debugger
The simplest possible way of implementing it is shown below. Let's assume you have a Symfony (PHP) project with structure as follows:
my-awesome-project
└───.idea
└───.git
└───.github
└───app
│ └───bin
│ └───config
│ └───public
│ └───src
│ └───tests
│ └───var
│ └───vendor
│ │ composer.json
│ │ composer.lock
│ Dockerfile
Content of your Dockerfile:
FROM ghcr.io/at-cloud-pro/caddy-php:4.0.0 AS app
COPY ./app /app
RUN composer install
USER www-data:www-data
In Dockerfile shown above you're just copying app
folder, and you're all set. You may install Composer packages or do
other actions that your application requires to run - it's extensive.
Last line is recommended to avoid privilege issues on files created in container by other processes.
Changelog is available here. Please update changelog each time commission is made. I adapted semantic versioning in this repository, and this versioning practice should be used.