This image contains caddy and PHP-FPM in the same container. To run both processes in the same container, we use hivemind, a Procfile compatible process manager.
FROM ghcr.io/shyim/wolfi-php/caddy:8.3
# Install missing extensions
RUN apk add --no-cache php-8.3-redis php-8.3-gd
# Copy your files
COPY . /var/www/html
docker build -t my-image .
docker run -p 8080:8080 my-image
You can run it for testing purposes also directly, docker run --rm -p 8080:8080 ghcr.io/shyim/wolfi-php/caddy:8.3
and you should see at http://localhost:8000
the php info page.
As this image bases on fpm, you can check out there how to configure PHP / PHP-FPM and install php extensions.
SERVER_NAME
- The server name for Caddy. Default is:8000
- This controls also the listing port of Caddy, use:8000
as example for port8000
CADDY_GLOBAL_OPTIONS
- Allows setting global options for Caddy like:debug
CADDY_EXTRA_CONFIG
- Allows setting extra Caddy configuration like add new virtual host:foo.com { root /app/public }
CADDY_SERVER_EXTRA_DIRECTIVES
- Allows setting extra Caddy configuration for the default virtual host. See here for all options
You can overwrite the Nginx configuration by copying your own configuration to /etc/caddy/Caddyfile
:
COPY Caddyfile /etc/caddy/Caddyfile
You can find the default configuration here.
You can run the container as a non-root user. The image has a user www-data
with UID 82. You can use it like this:
USER www-data