Repository navigation
What can I do to make a bare-bones build of FrankenPHP? #2803
Replies: 2 comments 1 reply
|
Your The FrankenPHP has three optional-feature tags (docs/compile.md):
With the static builder, static-php-cli reads extra tags from docker run --rm -v "$PWD/output:/output" -e OUTPUT_DIR=/output -e SPC_LOGS_DIR=/output/log \
-e PHP_EXTENSIONS="…your list…" \
-e PHP_EXTENSION_LIBS="…your list…" \
-e XCADDY_ARGS=" " \
-e SPC_CMD_VAR_FRANKENPHP_GO_TAGS="nomercure,nowatcher" \
dunglas/frankenphp:static-builder-muslA few notes:
To trim further, the rest is down to |
|
Thanks for that detailed info. As you say, some of the docs still refer to My main motivation is not so much binary size as achieving a reduced memory footprint and smaller attack surface for possible future vulnerabilties. @dunglas - I'll investiagte your suggestion, thanks, although I think I'd need to better understand the build system before attempting that! |

Your
XCADDY_ARGS=" "did work: the extra Caddy modules (cbrotli, the Mercure Caddy module, Vulcain) are gone. Mercure still shows up because FrankenPHP itself also imports the Mercure library (formercure_publish()and worker hot reload), and that part is turned off with a Go build tag, not with xcaddy modules.The
dunglas/mercurerow inphpinfo()comes from the Go build info (debug.ReadBuildInfo()inphpinfo.go), so it disappears once nothing in the binary imports the package.FrankenPHP has three optional-feature tags (docs/compile.md):
nomercuremercure.go,caddy/mercure.goand worker hot reload)nowatcher