Improvements in Docker

This commit is contained in:
djoven89
2025-06-24 11:28:30 +02:00
parent 9c4e6585f4
commit 68fcf2e641
5 changed files with 66 additions and 27 deletions
+4 -6
View File
@@ -1,15 +1,13 @@
/public/bundles/
public/bundles/
var/
vendor/
.phpunit.result.cache
/phpunit.xml
phpunit.xml
/phpunit.xml
.phpunit.result.cache
.php-cs-fixer.php
.php-cs-fixer.cache
/.php-cs-fixer.php
/.php-cs-fixer.cache
.git/
.github/
.vscode/
+33 -19
View File
@@ -1,4 +1,4 @@
FROM php:8.3-fpm-alpine AS php-system-setup
FROM php:8.3-fpm-alpine AS system-setup
RUN apk --no-cache add \
curl \
@@ -7,35 +7,49 @@ RUN apk --no-cache add \
icu-dev \
zip \
libzip-dev \
unzip
unzip \
nginx \
supervisor \
$PHPIZE_DEPS && \
pecl install apcu
RUN curl --remote-name https://curl.se/ca/cacert.pem \
&& mv cacert.pem /etc/ssl/certs/ca-certificates.crt
RUN docker-php-ext-install \
pdo \
pdo_mysql \
intl \
zip
RUN docker-php-ext-install opcache
RUN apk --no-cache add $PHPIZE_DEPS && \
pecl install apcu \
&& docker-php-ext-enable apcu
RUN curl --remote-name https://curl.se/ca/cacert.pem \
&& mv cacert.pem /etc/ssl/certs/ca-certificates.crt
zip \
opcache && \
docker-php-ext-enable apcu
COPY --from=composer:2.8.9 /usr/bin/composer /usr/local/bin/composer
FROM php-system-setup AS webserver-setup
RUN apk add --update --no-cache \
nginx \
supervisor
COPY ./docker/main/default.conf /etc/nginx/http.d/default.conf
COPY ./docker/main/supervisord.conf /etc/supervisord.conf
COPY ./docker/main/www.conf /usr/local/etc/php-fpm.d/www.conf
COPY ./docker/main/local.ini /usr/local/etc/php/conf.d/local.ini
FROM webserver-setup AS app-setup
# FPM configuration via ENV
ENV FPM_PM=dynamic
ENV FPM_PM_MAX_CHILDREN=5
ENV FPM_PM_START_SERVERS=2
ENV FPM_PM_MIN_SPARE_SERVERS=1
ENV FPM_PM_MAX_SPARE_SERVERS=3
# PHP configuration via ENV
ENV LOG_TO_STDOUT=1
ENV PHP_MEMORY_LIMIT=512M
ENV PHP_MAX_EXECUTION_TIME=30
ENV PHP_UPLOAD_MAX_FILESIZE=120M
ENV PHP_POST_MAX_SIZE=128M
ENV PHP_SESSION_SAVE_HANDLER=files
ENV PHP_SESSION_SAVE_PATH=
ENV PHP_DISPLAY_ERRORS=0
ENV PHP_DISPLAY_STARTUP_ERRORS=0
FROM system-setup AS app-setup
COPY . /app
RUN chown -R nginx:nginx /app
+2 -2
View File
@@ -1,10 +1,10 @@
server {
listen 80;
index index.php;
server_name localhost;
root /app/public;
index index.php;
error_log /dev/stdout;
access_log /dev/stdout;
+9
View File
@@ -0,0 +1,9 @@
memory_limit = ${PHP_MEMORY_LIMIT}
max_execution_time = ${PHP_MAX_EXECUTION_TIME}
upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}
post_max_size = ${PHP_POST_MAX_SIZE}
allow_url_fopen = 1
session.save_handler = ${PHP_SESSION_SAVE_HANDLER}
session.save_path = ${PHP_SESSION_SAVE_PATH}
display_errors = ${PHP_DISPLAY_ERRORS}
display_startup_errors = ${PHP_DISPLAY_STARTUP_ERRORS}
+18
View File
@@ -0,0 +1,18 @@
[global]
daemonize = no
[www]
user = nginx
group = nginx
listen = 9000
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
pm = ${FPM_PM}
pm.max_children = ${FPM_PM_MAX_CHILDREN}
pm.start_servers = ${FPM_PM_START_SERVERS}
pm.min_spare_servers = ${FPM_PM_MIN_SPARE_SERVERS}
pm.max_spare_servers = ${FPM_PM_MAX_SPARE_SERVERS}
catch_workers_output = yes