configs for php and caddy2
This commit is contained in:
parent
acebe9e98c
commit
f1ebcb1374
5
caddy2/php7.4/Caddyfile
Normal file
5
caddy2/php7.4/Caddyfile
Normal file
@ -0,0 +1,5 @@
|
||||
:8080
|
||||
|
||||
encode gzip
|
||||
php_fastcgi 127.0.0.1:9000
|
||||
file_server
|
||||
58
caddy2/php7.4/Dockerfile
Normal file
58
caddy2/php7.4/Dockerfile
Normal file
@ -0,0 +1,58 @@
|
||||
FROM caddy/caddy:v2.0.0-beta.17 as caddy
|
||||
|
||||
FROM php:7.4-fpm-alpine
|
||||
|
||||
ENV RUN_DEPS \
|
||||
zlib \
|
||||
libzip \
|
||||
libpng \
|
||||
libjpeg-turbo \
|
||||
postgresql-libs
|
||||
|
||||
ENV BUILD_DEPS \
|
||||
zlib-dev \
|
||||
libzip-dev \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
postgresql-dev
|
||||
|
||||
ENV PHP_EXTENSIONS \
|
||||
opcache \
|
||||
zip \
|
||||
gd \
|
||||
bcmath \
|
||||
mysqli \
|
||||
pdo_mysql \
|
||||
pgsql \
|
||||
pdo_pgsql
|
||||
|
||||
ENV PECL_EXTENSIONS \
|
||||
redis
|
||||
|
||||
RUN apk add --no-cache --virtual .build-deps $BUILD_DEPS \
|
||||
&& docker-php-ext-configure gd --with-jpeg \
|
||||
&& pecl install $PECL_EXTENSIONS \
|
||||
&& docker-php-ext-install -j "$(nproc)" $PHP_EXTENSIONS \
|
||||
&& docker-php-ext-enable $PECL_EXTENSIONS \
|
||||
&& apk del .build-deps
|
||||
|
||||
RUN apk add --no-cache --virtual .run-deps $RUN_DEPS
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
COPY config $PHP_INI_DIR/conf.d
|
||||
COPY php-fpm /usr/local/etc/php-fpm.d
|
||||
|
||||
COPY --from=caddy /config /config
|
||||
COPY --from=caddy /data /data
|
||||
COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
COPY index.php /var/www/html/
|
||||
|
||||
COPY php-caddy-entrypoint /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/php-caddy-entrypoint
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT [ "php-caddy-entrypoint" ]
|
||||
|
||||
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
||||
7
caddy2/php7.4/config/opcache.ini
Normal file
7
caddy2/php7.4/config/opcache.ini
Normal file
@ -0,0 +1,7 @@
|
||||
opcache.enable=1
|
||||
|
||||
opcache.memory_consumption=256
|
||||
opcache.interned_strings_buffer=16
|
||||
opcache.fast_shutdown=1
|
||||
|
||||
opcache.validate_timestamps=1
|
||||
2
caddy2/php7.4/config/upload.ini
Normal file
2
caddy2/php7.4/config/upload.ini
Normal file
@ -0,0 +1,2 @@
|
||||
post_max_size=100M
|
||||
upload_max_filesize=100M
|
||||
20
caddy2/php7.4/php-caddy-entrypoint
Normal file
20
caddy2/php7.4/php-caddy-entrypoint
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
FPM_CONFIG_DIR=/usr/local/etc/php-fpm.d
|
||||
|
||||
read_env_config() {
|
||||
prefix=$1
|
||||
output=$2
|
||||
|
||||
env | grep -E "^$prefix\..+=.+" | while IFS='=' read -r config_name config_value; do
|
||||
echo "${config_name#*.} = $config_value" >> "$output"
|
||||
done
|
||||
}
|
||||
|
||||
read_env_config PHP $PHP_INI_DIR/conf.d/zz-docker-env.ini
|
||||
read_env_config PHP_FPM $FPM_CONFIG_DIR/zz-docker.conf
|
||||
|
||||
php-fpm -D
|
||||
exec "$@"
|
||||
19
caddy2/php7.4/php-fpm/www.conf
Normal file
19
caddy2/php7.4/php-fpm/www.conf
Normal file
@ -0,0 +1,19 @@
|
||||
[www]
|
||||
|
||||
user = www-data
|
||||
group = www-data
|
||||
|
||||
listen = 127.0.0.1:9000
|
||||
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
security.limit_extensions = .php
|
||||
|
||||
ping.path = /ping
|
||||
ping.response = pong
|
||||
|
||||
access.format = "%R - %t \"%m %r %{HTTP_X_URI}e\" %s %{mili}d %{kilo}M %C%%"
|
||||
Loading…
Reference in New Issue
Block a user