Skip to content

Commit

Permalink
clean up a few phpfpm remnants
Browse files Browse the repository at this point in the history
  • Loading branch information
batonac committed Sep 19, 2024
1 parent daf2d72 commit eeb7358
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions wordpress.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let
LDFLAGS="$LDFLAGS -flto"
'';

# Explicitly enable XML support
# Explicitly enable XML support (required by FrankenPHP)
configureFlags = (oldAttrs.configureFlags or [ ]) ++ [
"--enable-xml"
"--with-libxml"
Expand Down Expand Up @@ -94,20 +94,13 @@ let
frankenphp = (pkgs.frankenphp.override {
php = phpBuild;
}).overrideAttrs (oldAttrs: {
# Here we override the let...in section
phpEmbedWithZts = phpBuild;
phpUnwrapped = phpBuild.unwrapped;
phpConfig = "${phpBuild.unwrapped.dev}/bin/php-config";
});

caddyfile = pkgs.writeText "Caddyfile" (builtins.readFile ./conf/Caddyfile);

start-server = pkgs.writeScriptBin "start-server" ''
#!${pkgs.busybox}/bin/sh
# Start Caddy/frankenphp
${pkgs.lib.getExe frankenphp} run --config ${caddyfile} --adapter caddyfile
'';

docker-entrypoint = pkgs.writeScriptBin "docker-entrypoint" (builtins.readFile ./docker-entrypoint.sh);

in
Expand All @@ -128,7 +121,7 @@ pkgs.dockerTools.buildLayeredImage {

config = {
Entrypoint = [ "${pkgs.busybox}/bin/sh" "${pkgs.lib.getExe docker-entrypoint}" ];
Cmd = [ "${pkgs.lib.getExe start-server}" ];
Cmd = [ "${pkgs.lib.getExe frankenphp}" "run" "--config" "${caddyfile}" "--adapter" "caddyfile" ];
ExposedPorts = {
"80/tcp" = { };
};
Expand All @@ -139,12 +132,6 @@ pkgs.dockerTools.buildLayeredImage {
mkdir -p tmp
chmod 1777 tmp
# enable Caddy logging
mkdir -p var/log/caddy
touch var/log/caddy/access.log
touch var/log/caddy/error.log
chmod -R 777 var/log/caddy
# Copy WordPress files
mkdir -p var/www/html
cp ${./conf/wp-config.php} wp-config.php
Expand All @@ -156,11 +143,7 @@ pkgs.dockerTools.buildLayeredImage {
# Symlink CA certificates
ln -s ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt etc/ssl/certs/ca-certificates.crt
# Set up PHP-FPM socket directory
mkdir -p run
chmod 777 run
# Symlink busybox for bash and env
# Symlink busybox for bash and env (required by wp-cli)
mkdir -p usr/bin
ln -s ${pkgs.busybox}/bin/busybox usr/bin/bash
ln -s ${pkgs.busybox}/bin/busybox usr/bin/env
Expand Down

0 comments on commit eeb7358

Please sign in to comment.