From 7b8caa04631d041fa75a1b3d78380e8363938e86 Mon Sep 17 00:00:00 2001 From: Sagent Date: Mon, 29 Jun 2026 12:32:50 +0000 Subject: [PATCH] fix: migrate from jcabillot/phpapache to dunglas/frankenphp --- Caddyfile | 10 ++++++++++ Dockerfile | 10 +++++++--- tests/test.sh | 15 +++++++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 Caddyfile diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..71a6ba4 --- /dev/null +++ b/Caddyfile @@ -0,0 +1,10 @@ +{ + auto_https off + frankenphp +} + +:8080 { + root * /app/public + encode zstd br gzip + file_server +} diff --git a/Dockerfile b/Dockerfile index c814681..f4e2fb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ -ARG VERSION="latest" -FROM "jcabillot/phpapache:${VERSION}" +FROM dunglas/frankenphp:1-php8.5-alpine LABEL maintainer="Julien Cabillot " -COPY "root" "/var/www/html" +WORKDIR /app + +COPY Caddyfile /etc/frankenphp/Caddyfile +COPY --chown=www-data:www-data root /app/public + +USER www-data diff --git a/tests/test.sh b/tests/test.sh index 23c1e80..8aad113 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -58,10 +58,17 @@ done echo "" echo "Test: GET / (HTML redirect)" -RESPONSE=$(curl -sf -D - "$BASE_URL/") -STATUS=$(echo "$RESPONSE" | head -1 | grep -oP '\d{3}') -CONTENT_TYPE=$(echo "$RESPONSE" | grep -i 'content-type' | tr -d '\r' | cut -d: -f2- | xargs) -BODY=$(echo "$RESPONSE" | sed -n '/^\r$/,$p' | tail -n +2) +# Use temp file to avoid pipefail/SIGPIPE issues +TMPDIR=$(mktemp -d) +cleanup() { + docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true + rm -rf "$TMPDIR" +} +curl -sf -o "$TMPDIR/body" -D "$TMPDIR/headers" "$BASE_URL/" +STATUS=$(head -1 "$TMPDIR/headers" | grep -oP '\d{3}') +CONTENT_TYPE=$(grep -i 'content-type' "$TMPDIR/headers" | tr -d '\r' | cut -d: -f2- | xargs) +BODY=$(cat "$TMPDIR/body") +trap cleanup EXIT assert "HTTP status is 200" "200" "$STATUS" assert_match "Content-Type is text/html" "text/html" "$CONTENT_TYPE"