-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
143 lines (122 loc) · 4.7 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#syntax=docker/dockerfile:1
ARG PHP_VERSION
ARG COMPOSER_VERSION
ARG ALPINE_VERSION
FROM composer:$COMPOSER_VERSION as local-composer
FROM php:$PHP_VERSION-fpm-alpine$ALPINE_VERSION as base
WORKDIR /app
COPY --from=mlocati/php-extension-installer:2.2.19 /usr/bin/install-php-extensions /usr/bin/
RUN <<EOT
set -eux
apk add --no-cache bash fcgi gettext git jq nginx postgresql-client s6 su-exec
install-php-extensions bcmath calendar exif intl pcntl opcache pgsql pdo_pgsql redis zip
cd "$PHP_INI_DIR"
sed -ri -e 's/^(access.log)/;\1/' ../php-fpm.d/docker.conf
sed -ri \
-e 's/^;(ping\.path)/\1/' \
-e 's/^;(pm\.status_path)/\1/' \
-e 's/^;?(pm\.max_children).*/\1 = ${PHP_FPM_PM_MAX_CHILDREN}/' \
-e 's/^;?(pm\.start_servers).*/\1 = ${PHP_FPM_PM_START_SERVERS}/' \
-e 's/^;?(pm\.min_spare_servers).*/\1 = ${PHP_FPM_PM_MIN_SPARE_SERVERS}/' \
-e 's/^;?(pm\.max_spare_servers).*/\1 = ${PHP_FPM_PM_MAX_SPARE_SERVERS}/' \
-e 's/^;?(pm\.max_requests).*/\1 = ${PHP_FPM_PM_MAX_REQUESTS}/' \
../php-fpm.d/www.conf
sed -ri \
-e 's/^;?(max_execution_time).*/\1 = ${PHP_MAX_EXECUTION_TIME}/' \
-e 's/^;?(max_input_vars).*/\1 = ${PHP_MAX_INPUT_VARS}/' \
-e 's/^;?(memory_limit).*/\1 = ${PHP_MEMORY_LIMIT}/' \
-e 's/^;?(post_max_size).*/\1 = ${PHP_POST_MAX_SIZE}/' \
-e 's/^;?(upload_max_filesize).*/\1 = ${PHP_UPLOAD_MAX_FILESIZE}/' \
-e 's/^;?(max_file_uploads).*/\1 = ${PHP_MAX_FILE_UPLOADS}/' \
-e 's/^;?(expose_php).*/\1 = Off/' \
php.ini-production
ln -s php.ini-production php.ini
mkdir -p /run/nginx
sed -ri -e 's/#(tcp_nopush on;)/\1/' /etc/nginx/nginx.conf
if [ -d /etc/nginx/http.d ]; then
mv /etc/nginx/http.d /etc/nginx/conf.d
sed -ri \
-e 's|/etc/nginx/http.d|/etc/nginx/conf.d|' \
-e 's|^include /etc/nginx/conf.d/\*.conf;||' \
/etc/nginx/nginx.conf
fi
EOT
ENV LC_ALL=C
ARG PHP_FPM_PM_MAX_CHILDREN=80
ENV PHP_FPM_PM_MAX_CHILDREN=$PHP_FPM_PM_MAX_CHILDREN
ARG PHP_FPM_PM_START_SERVERS=2
ENV PHP_FPM_PM_START_SERVERS=$PHP_FPM_PM_START_SERVERS
ARG PHP_FPM_PM_MIN_SPARE_SERVERS=1
ENV PHP_FPM_PM_MIN_SPARE_SERVERS=$PHP_FPM_PM_MIN_SPARE_SERVERS
ARG PHP_FPM_PM_MAX_SPARE_SERVERS=3
ENV PHP_FPM_PM_MAX_SPARE_SERVERS=$PHP_FPM_PM_MAX_SPARE_SERVERS
ARG PHP_FPM_PM_MAX_REQUESTS=0
ENV PHP_FPM_PM_MAX_REQUESTS=$PHP_FPM_PM_MAX_REQUESTS
ARG PHP_MAX_EXECUTION_TIME=30
ENV PHP_MAX_EXECUTION_TIME=$PHP_MAX_EXECUTION_TIME
ARG PHP_MAX_INPUT_VARS=1000
ENV PHP_MAX_INPUT_VARS=$PHP_MAX_INPUT_VARS
ARG PHP_MEMORY_LIMIT=256M
ENV PHP_MEMORY_LIMIT=$PHP_MEMORY_LIMIT
ARG PHP_POST_MAX_SIZE=32M
ENV PHP_POST_MAX_SIZE=$PHP_POST_MAX_SIZE
ARG PHP_UPLOAD_MAX_FILESIZE=8M
ENV PHP_UPLOAD_MAX_FILESIZE=$PHP_UPLOAD_MAX_FILESIZE
ARG PHP_MAX_FILE_UPLOADS=20
ENV PHP_MAX_FILE_UPLOADS=$PHP_MAX_FILE_UPLOADS
ARG COMPOSER_MEMORY_LIMIT=-1
ENV COMPOSER_MEMORY_LIMIT=$COMPOSER_MEMORY_LIMIT
ARG COMPOSER_VERSION
COPY --from=local-composer /usr/bin/composer /usr/bin/composer
RUN <<EOT
set -eux
if [ "$COMPOSER_VERSION" = "1" ]; then
composer global require hirak/prestissimo
composer clear-cache
fi
EOT
COPY --from=ghcr.io/roadrunner-server/roadrunner:2024.1.5 /usr/bin/rr /usr/local/bin/rr
COPY rootfs/ /
CMD ["s6-svscan", "/etc/services.d"]
FROM base as onbuild
ONBUILD ARG PHP_FPM_PM_MAX_CHILDREN
ONBUILD ENV PHP_FPM_PM_MAX_CHILDREN=${PHP_FPM_PM_MAX_CHILDREN:-20}
ONBUILD ARG PHP_FPM_PM_START_SERVERS
ONBUILD ENV PHP_FPM_PM_START_SERVERS=${PHP_FPM_PM_START_SERVERS:-2}
ONBUILD ARG PHP_FPM_PM_MIN_SPARE_SERVERS
ONBUILD ENV PHP_FPM_PM_MIN_SPARE_SERVERS=${PHP_FPM_PM_MIN_SPARE_SERVERS:-1}
ONBUILD ARG PHP_FPM_PM_MAX_SPARE_SERVERS
ONBUILD ENV PHP_FPM_PM_MAX_SPARE_SERVERS=${PHP_FPM_PM_MAX_SPARE_SERVERS:-3}
ONBUILD ARG PHP_FPM_PM_MAX_REQUESTS
ONBUILD ENV PHP_FPM_PM_MAX_REQUESTS=${PHP_FPM_PM_MAX_REQUESTS:-0}
ONBUILD ARG PHP_MAX_EXECUTION_TIME
ONBUILD ENV PHP_MAX_EXECUTION_TIME=${PHP_MAX_EXECUTION_TIME:-30}
ONBUILD ARG PHP_MAX_INPUT_VARS
ONBUILD ENV PHP_MAX_INPUT_VARS=${PHP_MAX_INPUT_VARS:-1000}
ONBUILD ARG PHP_MEMORY_LIMIT
ONBUILD ENV PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}
ONBUILD ARG PHP_POST_MAX_SIZE
ONBUILD ENV PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-32M}
ONBUILD ARG PHP_UPLOAD_MAX_FILESIZE
ONBUILD ENV PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE:-8M}
ONBUILD ARG PHP_MAX_FILE_UPLOADS
ONBUILD ENV PHP_MAX_FILE_UPLOADS=${PHP_MAX_FILE_UPLOADS:-20}
ONBUILD ARG SKIP_BUILD
ONBUILD ARG DEPS
ONBUILD ARG INSTALL
ONBUILD ARG INSTALL_GD
ONBUILD ARG INSTALL_IMAGICK
ONBUILD ARG INSTALL_MOSQUITTO
ONBUILD ARG INSTALL_MYSQL
ONBUILD ARG INSTALL_SQLSRV
ONBUILD ARG INSTALL_XDEBUG
ONBUILD ARG NGINX_ROOT
ONBUILD ARG NGINX_EXPIRES
ONBUILD ARG COMPOSER_VERSION
ONBUILD ARG IPE_GD_WITHOUTAVIF=1
ONBUILD RUN <<EOT
set -eux
if [ "${SKIP_BUILD:-}" != "true" ]; then
clevyr-build
fi
EOT