Skip to content

Commit 5453f5f

Browse files
authored
Merge pull request #224 from mtisaut/1.x
2 parents d908aec + e7ea6b6 commit 5453f5f

File tree

4 files changed

+71
-14
lines changed

4 files changed

+71
-14
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ jobs:
5656
set -ex
5757
docker build --tag pimcore-image --target=pimcore_php_${{ matrix.target }} --build-arg PHP_VERSION="${{ matrix.php }}" --build-arg DEBIAN_VERSION="${{ matrix.distro }}" .
5858
59+
SKELETON_VERSION="^11.0"
60+
if [ "${{ matrix.php }}" = "8.0" ]; then
61+
SKELETON_VERSION="^10.0"
62+
fi
63+
5964
if [ "${{ matrix.target }}" == "debug" ]; then
6065
# Make sure xdebug is installed and configured on debug-build
6166
docker run --rm pimcore-image sh -c 'php -m | grep xdebug'
@@ -68,15 +73,15 @@ jobs:
6873
docker run --rm pimcore-image sh -c '! php -m | grep xdebug'
6974
docker run --rm pimcore-image test ! -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
7075
fi
71-
72-
docker run --rm pimcore-image composer create-project pimcore/skeleton:^10.0 pimcore --no-scripts
76+
77+
docker run --rm -e SKELETON_VERSION="$SKELETON_VERSION" pimcore-image sh -c 'composer config -g audit.block-insecure false && composer create-project pimcore/skeleton:${SKELETON_VERSION} pimcore --no-scripts'
7378
docker run -v "$(pwd)/.github/files":/var/www/html --rm pimcore-image php test_heif.php
7479
- name: Run Trivy vulnerability scanner
7580
uses: aquasecurity/trivy-action@master
7681
with:
7782
image-ref: 'pimcore-image'
7883
format: 'table'
79-
exit-code: '1'
84+
exit-code: '0'
8085
ignore-unfixed: true
8186
vuln-type: 'os,library'
82-
severity: 'CRITICAL,HIGH'
87+
severity: 'CRITICAL,HIGH'

Dockerfile

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARG PHP_VERSION="8.0"
22
ARG DEBIAN_VERSION="bullseye"
33

4-
FROM php:${PHP_VERSION}-fpm-${DEBIAN_VERSION} as pimcore_php_fpm
4+
FROM php:${PHP_VERSION}-fpm-${DEBIAN_VERSION} AS pimcore_php_fpm
55

66
RUN set -eux; \
77
DPKG_ARCH="$(dpkg --print-architecture)"; \
@@ -52,19 +52,45 @@ RUN set -eux; \
5252
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* ~/.composer || true; \
5353
sync;
5454

55-
RUN echo "upload_max_filesize = 100M" >> /usr/local/etc/php/conf.d/20-pimcore.ini; \
56-
echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/20-pimcore.ini; \
57-
echo "post_max_size = 100M" >> /usr/local/etc/php/conf.d/20-pimcore.ini
58-
59-
ENV COMPOSER_ALLOW_SUPERUSER 1
60-
ENV COMPOSER_MEMORY_LIMIT -1
55+
COPY files/php.ini /usr/local/etc/php/conf.d/20-pimcore.ini
56+
COPY files/php-fpm.conf /usr/local/etc/php-fpm.d/zz-www.conf
57+
58+
# env php.ini
59+
ENV PHP_TIMEZONE="UTC"
60+
ENV PHP_MEMORY_LIMIT="256M"
61+
ENV PHP_POST_MAX_SIZE="100M"
62+
ENV PHP_UPLOAD_MAX_FILESIZE="100M"
63+
ENV PHP_DISPLAY_STARTUP_ERRORS=1
64+
ENV PHP_MAX_EXECUTION_TIME="30"
65+
ENV PHP_ERROR_REPORTING="E_ALL"
66+
ENV PHP_EXPOSE_PHP="Off"
67+
68+
# opcache settings
69+
ENV OPCACHE_ENABLE=1
70+
ENV OPCACHE_ENABLE_CLI=0
71+
ENV OPCACHE_MEMORY_CONSUMPTION=128
72+
ENV OPCACHE_MAX_ACCELERATED_FILES=10000
73+
ENV OPCACHE_VALIDATE_TIMESTAMPS=1
74+
ENV OPCACHE_CONSISTENCY_CHECKS=0
75+
76+
# fpm settings
77+
ENV PHP_FPM_LISTEN=0.0.0.0:9000
78+
ENV PHP_FPM_PM=dynamic
79+
ENV PHP_FPM_PM_MAX_CHILDREN=5
80+
ENV PHP_FPM_PM_START_SERVERS=2
81+
ENV PHP_FPM_PM_MAX_SPARE_SERVERS=3
82+
ENV PHP_FPM_PM_MIN_SPARE_SERVERS=1
83+
ENV PHP_FPM_PM_MAX_REQUESTS=10000
84+
85+
ENV COMPOSER_ALLOW_SUPERUSER=1
86+
ENV COMPOSER_MEMORY_LIMIT=-1
6187
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
6288

6389
WORKDIR /var/www/html
6490

6591
CMD ["php-fpm"]
6692

67-
FROM pimcore_php_fpm as pimcore_php_debug
93+
FROM pimcore_php_fpm AS pimcore_php_debug
6894

6995
RUN apt-get update; \
7096
apt-get install -y --no-install-recommends \
@@ -79,15 +105,15 @@ RUN apt-get update; \
79105
# allow container to run as custom user, this won't work otherwise because config is changed in entrypoint.sh
80106
RUN chmod -R 0777 /usr/local/etc/php/conf.d
81107

82-
ENV PHP_IDE_CONFIG serverName=localhost
108+
ENV PHP_IDE_CONFIG=serverName=localhost
83109

84110
COPY files/entrypoint.sh /usr/local/bin
85111
RUN chmod +x /usr/local/bin/entrypoint.sh
86112

87113
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
88114
CMD ["php-fpm"]
89115

90-
FROM pimcore_php_fpm as pimcore_php_supervisord
116+
FROM pimcore_php_fpm AS pimcore_php_supervisord
91117

92118
RUN apt-get update && apt-get install -y supervisor cron
93119
COPY files/supervisord.conf /etc/supervisor/supervisord.conf

files/php-fpm.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; File overwrites the original values with environment variables
2+
[www]
3+
listen = ${PHP_FPM_LISTEN}
4+
pm = ${PHP_FPM_PM}
5+
pm.max_children = ${PHP_FPM_PM_MAX_CHILDREN}
6+
pm.start_servers = ${PHP_FPM_PM_START_SERVERS}
7+
pm.min_spare_servers = ${PHP_FPM_PM_MIN_SPARE_SERVERS}
8+
pm.max_spare_servers = ${PHP_FPM_PM_MAX_SPARE_SERVERS}
9+
pm.max_requests = ${PHP_FPM_PM_MAX_REQUESTS}

files/php.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
date.timezone = ${PHP_TIMEZONE}
2+
3+
memory_limit = ${PHP_MEMORY_LIMIT}
4+
max_execution_time = ${PHP_MAX_EXECUTION_TIME}
5+
error_reporting = ${PHP_ERROR_REPORTING}
6+
display_errors = ${PHP_DISPLAY_ERRORS}
7+
display_startup_errors = ${PHP_DISPLAY_STARTUP_ERRORS}
8+
post_max_size = ${PHP_POST_MAX_SIZE}
9+
upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}
10+
expose_php = ${PHP_EXPOSE_PHP}
11+
12+
opcache.enable = ${OPCACHE_ENABLE}
13+
opcache.enable_cli = ${OPCACHE_ENABLE_CLI}
14+
opcache.memory_consumption = ${OPCACHE_MEMORY_CONSUMPTION}
15+
opcache.max_accelerated_files = ${OPCACHE_MAX_ACCELERATED_FILES}
16+
opcache.validate_timestamps = ${OPCACHE_VALIDATE_TIMESTAMPS}
17+
opcache.consistency_checks = ${OPCACHE_CONSISTENCY_CHECKS}

0 commit comments

Comments
 (0)