-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First implementation of frankenphp to remove in future varnish and nginx,
- Loading branch information
1 parent
41085f9
commit 31cc3a1
Showing
10 changed files
with
227 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ SOLR_CORE_NAME=roadiz | |
|
||
PUBLIC_APP_PORT=8681 | ||
PUBLIC_VARNISH_PORT=8682 | ||
PUBLIC_APP_HTTPS_PORT=4431 | ||
PUBLIC_PMA_PORT=8686 | ||
PUBLIC_SOLR_PORT=8684 | ||
PUBLIC_MAILER_PORT=8625 | ||
|
@@ -86,7 +87,7 @@ REDIS_DSN=redis://redis | |
# | ||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" | ||
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7&charset=utf8mb4" | ||
DATABASE_URL="mysql://db_user:db_password@db/db_name?serverVersion=8.0.38&charset=utf8mb4" | ||
DATABASE_URL="mysql://db_user:db_password@db/db_name?serverVersion=8.0.40&charset=utf8mb4" | ||
#DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,6 @@ usermod -u ${UID} mysql | |
groupmod -g ${GID} mysql | ||
EOF | ||
|
||
|
||
########### | ||
# Varnish # | ||
########### | ||
|
@@ -82,7 +81,6 @@ LABEL org.opencontainers.image.authors="[email protected]" | |
|
||
COPY --link docker/varnish/default.vcl /etc/varnish/ | ||
|
||
|
||
####### | ||
# PHP # | ||
####### | ||
|
@@ -145,6 +143,94 @@ EOF | |
|
||
WORKDIR /app | ||
|
||
#################### | ||
# PHP - FRANKENPHP # | ||
#################### | ||
|
||
FROM dunglas/frankenphp:php${PHP_VERSION}-bookworm AS php-franken | ||
|
||
LABEL org.opencontainers.image.authors="[email protected], [email protected]" | ||
|
||
ARG UID | ||
ARG GID | ||
|
||
ARG COMPOSER_VERSION=2.8.1 | ||
ARG PHP_EXTENSION_INSTALLER_VERSION=2.6.0 | ||
ARG PHP_EXTENSION_REDIS_VERSION=6.1.0 | ||
|
||
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"] | ||
|
||
ENV APP_FFMPEG_PATH=/usr/bin/ffmpeg | ||
ENV APP_RUNTIME=Runtime\\FrankenPhpSymfony\\Runtime | ||
ENV FRANKENPHP_CONFIG="worker ./public/index.php" | ||
|
||
RUN <<EOF | ||
apt-get --quiet update | ||
apt-get --quiet --yes --purge --autoremove upgrade | ||
# Packages - System | ||
apt-get --quiet --yes --no-install-recommends --verbose-versions install \ | ||
acl \ | ||
less \ | ||
sudo \ | ||
ffmpeg | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# User | ||
addgroup --gid ${UID} php | ||
adduser --home /home/php --shell /bin/bash --uid ${GID} --gecos php --ingroup php --disabled-password php | ||
echo "php ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/php | ||
|
||
# App | ||
install --verbose --owner php --group php --mode 0755 --directory /app | ||
|
||
# Php extensions | ||
install-php-extensions \ | ||
@composer-${COMPOSER_VERSION} \ | ||
fileinfo \ | ||
gd \ | ||
imagick \ | ||
iconv \ | ||
intl \ | ||
json \ | ||
mbstring \ | ||
opcache \ | ||
openssl \ | ||
pcntl \ | ||
pdo_mysql \ | ||
simplexml \ | ||
xsl \ | ||
zip \ | ||
redis-${PHP_EXTENSION_REDIS_VERSION} | ||
|
||
setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp | ||
|
||
chown --recursive ${UID}:${GID} /data/caddy /config/caddy | ||
|
||
EOF | ||
|
||
COPY --link docker/frankenphp/conf.d/app.ini ${PHP_INI_DIR}/conf.d/ | ||
COPY --link --chmod=755 docker/frankenphp/docker-entrypoint.dev /usr/local/bin/docker-entrypoint | ||
COPY --link docker/frankenphp/Caddyfile /etc/caddy/Caddyfile | ||
|
||
ENTRYPOINT ["docker-entrypoint"] | ||
|
||
WORKDIR /app | ||
|
||
####################### | ||
# Php - franken - Dev # | ||
####################### | ||
|
||
FROM php-franken AS php-dev-franken | ||
|
||
ENV XDEBUG_MODE=off | ||
|
||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
|
||
COPY --link docker/frankenphp/conf.d/app.dev.ini ${PHP_INI_DIR}/conf.d/ | ||
|
||
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ] | ||
|
||
USER php | ||
|
||
############# | ||
# Php - Dev # | ||
|
@@ -164,7 +250,6 @@ CMD ["php-fpm"] | |
|
||
USER php | ||
|
||
|
||
############## | ||
# Cron - Dev # | ||
############## | ||
|
@@ -190,7 +275,6 @@ ENTRYPOINT ["docker-entrypoint"] | |
|
||
USER root | ||
|
||
|
||
######### | ||
# Nginx # | ||
######### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
{$CADDY_GLOBAL_OPTIONS} | ||
|
||
servers { | ||
trusted_proxies static 0.0.0.0/0 | ||
} | ||
|
||
frankenphp { | ||
{$FRANKENPHP_CONFIG} | ||
} | ||
} | ||
|
||
{$SERVER_NAME:localhost} { | ||
log { | ||
# Redact the authorization query parameter that can be set by Mercure | ||
format filter { | ||
request>uri query { | ||
replace authorization REDACTED | ||
} | ||
} | ||
} | ||
|
||
root * /app/public | ||
encode zstd br gzip | ||
|
||
php_server | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; See https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host | ||
; See https://github.com/docker/for-linux/issues/264 | ||
; The `client_host` below may optionally be replaced with `discover_client_host=yes` | ||
; Add `start_with_request=yes` to start debug session on each request | ||
xdebug.client_host = xdebug://gateway | ||
|
||
date.timezone = Europe/Paris | ||
session.auto_start = Off | ||
; Session ID cannot be passed through URLs | ||
session.use_only_cookies = On | ||
; Uses a secure connection (HTTPS) if possible | ||
; session.cookie_secure = On | ||
; Do not accept uninitialized session ID | ||
session.use_strict_mode = On | ||
; Do not make session cookie available to JS | ||
session.cookie_httponly = On | ||
short_open_tag = Off | ||
|
||
; http://symfony.com/doc/current/performance.html | ||
; Configure OPcache for Maximum Performance | ||
opcache.revalidate_freq = 0 | ||
opcache.memory_consumption = 256 | ||
opcache.max_accelerated_files = 20000 | ||
opcache.interned_strings_buffer = 16 | ||
|
||
; Configure the PHP realpath Cache | ||
realpath_cache_size = 4096K | ||
realpath_cache_ttl = 600 | ||
|
||
memory_limit = 512M | ||
post_max_size = 128M | ||
upload_max_filesize = 64M | ||
expose_php = On | ||
display_errors = On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
expose_php = 0 | ||
date.timezone = Europe/Paris | ||
apc.enable_cli = 1 | ||
session.use_strict_mode = 1 | ||
zend.detect_unicode = 0 | ||
|
||
; https://symfony.com/doc/current/performance.html | ||
realpath_cache_size = 4096K | ||
realpath_cache_ttl = 600 | ||
opcache.interned_strings_buffer = 16 | ||
opcache.max_accelerated_files = 20000 | ||
opcache.memory_consumption = 256 | ||
opcache.enable_file_override = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
exec docker-php-entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
worker { | ||
file ./public/index.php | ||
env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime | ||
} |