Skip to content

Commit

Permalink
8.4 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Jan 7, 2025
1 parent 5486937 commit 92e1219
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
phpversion:
- 8.3
- 8.4
- 8.4-frankenphp
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -43,6 +44,7 @@ jobs:
phpversion:
- 8.3
- 8.4
- 8.4-frankenphp
runs-on: ubuntu-latest-arm64
steps:
- name: Checkout
Expand Down Expand Up @@ -72,6 +74,7 @@ jobs:
phpversion:
- 8.3
- 8.4
- 8.4-frankenphp
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
68 changes: 68 additions & 0 deletions 8.4-frankenphp/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# -----------------------------------------------------
# FrankenPHP
#------------------------------------------------------
FROM dunglas/frankenphp:1-php8.4

ARG PORT=9001

ENV PORT=$PORT SERVER_NAME=":80, :$PORT"
ENV COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_NO_INTERACTION=1 COMPOSER_CACHE_DIR="/tmp"
ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"

COPY --link --chmod=755 ./8.4-frankenphp/docker-entrypoint.sh /usr/local/bin/docker-entrypoint

ENTRYPOINT ["docker-entrypoint"]

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
acl \
file \
gettext \
gifsicle \
git \
imagemagick \
jpegoptim \
libexif-dev \
libheif-dev \
libvips42 \
optipng \
pngquant \
procps \
supervisor \
unzip \
webp \
zip \
&& rm -rf /var/lib/apt/lists/*

RUN set -eux; \
install-php-extensions \
@composer \
amqp \
apcu \
bcmath \
exif \
ffi \
gd \
gmp \
igbinary \
imagick \
intl \
maxminddb \
mongodb \
opcache \
pcntl \
pdo_mysql \
pdo_pgsql \
redis \
sockets \
sysvmsg \
sysvsem \
sysvshm \
uuid \
xsl \
zip \
;

# Copying manifest files to host
COPY ./8.4-frankenphp/manifest /
8 changes: 8 additions & 0 deletions 8.4-frankenphp/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ -z "$(ls -A 'vendor/' 2>/dev/null)" ]; then
composer install --prefer-dist --no-progress --no-interaction
fi

exec docker-php-entrypoint "$@"
26 changes: 26 additions & 0 deletions 8.4-frankenphp/manifest/etc/caddy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
{$CADDY_GLOBAL_OPTIONS}

frankenphp {
{$FRANKENPHP_CONFIG}
}
}

{$CADDY_EXTRA_CONFIG}

{$SERVER_NAME:localhost} {
log {
output stdout
format console
}

root * /app/public
encode zstd br gzip

{$CADDY_SERVER_EXTRA_DIRECTIVES}

# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-topics=()"

php_server
}
4 changes: 4 additions & 0 deletions 8.4-frankenphp/manifest/etc/caddy/worker.Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
worker {
file /app/public/index.php
env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime
}
7 changes: 7 additions & 0 deletions 8.4-frankenphp/manifest/etc/supervisor/conf.d/frankenphp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[program:frankenphp]
command=/usr/local/bin/frankenphp run --config /etc/caddy/Caddyfile --adapter caddyfile
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
28 changes: 28 additions & 0 deletions 8.4-frankenphp/manifest/etc/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)

[supervisord]
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
user=root ;

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket

; [eventlistener:stdout]
; command = supervisor_stdout
; buffer_size = 100
; events = PROCESS_LOG
; result_handler = supervisor_stdout:event_handler

[include]
files = /etc/supervisor/conf.d/*.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zend.max_allowed_stack_size=-1
ffi.enable=true
14 changes: 14 additions & 0 deletions 8.4-frankenphp/manifest/usr/local/etc/php/app.conf.d/10-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[PHP]
error_reporting = E_ALL
display_errors = Off
log_errors = On
error_log = /proc/self/fd/2
memory_limit = -1
max_execution_time = 30
max_input_time = 30
expose_php = 0
date.timezone = UTC
session_use_strict_mode = 1
session.auto_start = Off
short_open_tag = Off
zend.detect_unicode = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; maximum memory allocated to store the results
realpath_cache_size=4096K

; save the results for 10 minutes (600 seconds)
realpath_cache_ttl=600
41 changes: 29 additions & 12 deletions 8.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,57 @@ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH xcaddy build
# -----------------------------------------------------
# App Itself
# -----------------------------------------------------
FROM php:$PHP_VERSION-fpm-alpine
FROM php:$PHP_VERSION-fpm

ARG PORT=9001
ARG PUBLIC_DIR=public

ENV PORT=$PORT
ENV PUBLIC_DIR=$PUBLIC_DIR

ENV REQUIRED_PACKAGES="git make zip curl libpq supervisor gettext acl fcgi python3 ca-certificates pcre rabbitmq-c icu libavif libwebp libpng freetype libjpeg-turbo libacl libheif libde265 imagemagick imagemagick-dev imagemagick-libs jpegoptim optipng pngquant gifsicle linux-headers file"
ENV EXTENSIONS="redis apcu ast maxminddb amqp zip pdo_mysql pdo_pgsql bcmath opcache gettext intl exif pcntl sysvmsg sysvsem sysvshm xsl uuid igbinary bz2 gmp sockets Imagick/imagick@65e27f2bc0 gd"
ENV EXTENSIONS="redis apcu ast maxminddb amqp zip pdo_mysql pdo_pgsql bcmath opcache gettext intl exif pcntl sysvmsg sysvsem sysvshm xsl uuid igbinary bz2 gmp sockets imagick gd"

ENV DOCKER=true
ENV COMPOSER_ALLOW_SUPERUSER=1 COMPOSER_NO_INTERACTION=1 COMPOSER_CACHE_DIR="/tmp"

WORKDIR /app

# Copying manifest files to host
COPY ./8.4/manifest /
ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/app.conf.d"

# Caddy
COPY --from=builder /usr/bin/caddy /usr/local/bin/caddy

# Composer install
COPY --from=composer/composer:2-bin /composer /usr/bin/composer

WORKDIR /app

# Copying manifest files to host
COPY ./8.4/manifest /

# php extensions installer: https://github.com/mlocati/docker-php-extension-installer
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions

# Install required packages
RUN apk add --update --no-cache $REQUIRED_PACKAGES && rm -rf /var/cache/apk/*
RUN apt-get update && apt-get install -y --no-install-recommends \
acl \
file \
gettext \
gifsicle \
git \
imagemagick \
jpegoptim \
libexif-dev \
libheif-dev \
libvips42 \
optipng \
pngquant \
procps \
supervisor \
unzip \
webp \
zip \
&& rm -rf /var/lib/apt/lists/*

# Install PHP extensions
RUN IPE_ICU_EN_ONLY=1 install-php-extensions $EXTENSIONS
RUN set -eux; install-php-extensions $EXTENSIONS

# Update ulimit
RUN ulimit -n 16384
RUN ulimit -n 16384
12 changes: 12 additions & 0 deletions 8.4/manifest/usr/local/etc/php/app.conf.d/10-apc.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[apcu]
apc.shm_size=128M
apc.enable_cli=1
apc.rfc1867=1
; PHP file cache 1 hour
apc.ttl=3600
; User cache 2 hour
apc.user_ttl=7200
; Garbage collection 1 hour
apc.gc_ttl=3600
; check files
apc.stat=1
5 changes: 5 additions & 0 deletions 8.4/manifest/usr/local/etc/php/app.conf.d/10-opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[opcache]
opcache.memory_consumption=256M
opcache.max_accelerated_files=20000
opcache_enable_file_override=1
opcache.interned_strings_buffer=16

0 comments on commit 92e1219

Please sign in to comment.