Skip to content

Latest commit

 

History

History

caddy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Caddy + PHP-FPM

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.

Usage

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.

PHP Extensions / PHP Configuration

As this image bases on fpm, you can check out there how to configure PHP / PHP-FPM and install php extensions.

Caddy Configuration

  • SERVER_NAME - The server name for Caddy. Default is :8000 - This controls also the listing port of Caddy, use :8000 as example for port 8000
  • CADDY_GLOBAL_OPTIONS - Allows to set global options for Caddy like: debug
  • CADDY_EXTRA_CONFIG - Allows to set extra Caddy configuration like add new virtual host: foo.com { root /app/public }
  • CADDY_SERVER_EXTRA_DIRECTIVES - Allows to set extra Caddy configuration for the default virtual host. See here for all options

Overwrite Caddy Configuration

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.

Running rootless

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