Skip to content

Latest commit

 

History

History

frankenphp

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

FrankenPHP

We provide also a replacement like the official FrankenPHP image same Caddyfile, but with Wolfi.

Usage example

# 8.2 is also available
FROM ghcr.io/shyim/wolfi-php/frankenphp:8.3

# copy source code to /app/public
COPY . /app/public
docker build -t my-image .
docker run --rm -p 80:80 -p 443:443 my-image

Disabling HTTPS

If you want to disable HTTPS, you can use the following environment variable:

docker run \
    --rm \
    -e SERVER_NAME=:80 \
    -p 80:80 my-image

Available environment variables

  • SERVER_NAME - The server name for Caddy. Default is localhost - This controls also the listing port of Caddy, use :8000 as example for port 8000
  • FRANKENPHP_CONFIG - Allows setting configuration for FrankenPHP specific like: worker ./public/index.php
  • 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

Rootless

To run the container, as a non-root user, you can do the following:

FROM ghcr.io/shyim/wolfi-php/frankenphp:8.3

ARG USER=www-data

RUN \
    mkdir -p /data/caddy && mkdir -p /config/caddy; \
    apk add --no-cache libcap-utils; \
	adduser -D ${USER}; \
	# Add additional capability to bind to port 80 and 443
	setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/frankenphp; \
	# Give write access to /data/caddy and /config/caddy
	chown -R ${USER}:${USER} /data/caddy && chown -R ${USER}:${USER} /config/caddy; \
    apk del libcap-utils

USER ${USER}

Installing extensions

To install PHP extensions, you can use the apk package manager. For example, to install the gd extension, you can run:

# pick one of these
FROM ghcr.io/shyim/wolfi-php/base:latest
# frankenphp one, bases on the base image
FROM ghcr.io/shyim/wolfi-php/frankenphp:8.3

RUN apk add --no-cache php-frankenphp-8.3-gd

It's important that you only install extensions matching to your PHP version and with the php-frankenphp prefix.