This commit is contained in:
Michael RICOIS 2018-03-27 16:32:26 +02:00
parent f7d8e3c470
commit 0d670e3081
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,48 @@
FROM debian:buster-slim
# Environment
ENV TERM xterm
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=Europe/Paris
# Installation
RUN apt-get update && apt-get -y install software-properties-common procps gnupg nano wget git \
&& apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 \
&& add-apt-repository 'deb [arch=amd64] http://ftp.igh.cnrs.fr/pub/mariadb/repo/10.2/debian stretch main' \
&& apt-get update && apt-get -y upgrade && apt-get -y install mariadb-client-10.2 pwgen \
php7.2-fpm php7.2-mbstring php7.2-curl php7.2-xmlrpc php7.2-xsl php7.2-mysql php7.2-json php7.2-intl \
php7.2-zip php7.2-gd php-apcu \
&& rm /etc/php/7.2/fpm/conf.d/20-apcu_bc.ini \
&& sed -i -e 's/max_execution_time = 30/max_execution_time = 300/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/short_open_tag = Off/short_open_tag = On/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/;realpath_cache_size = 16k/realpath_cache_size = 1M/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/;mbstring.internal_encoding = UTF-8/mbstring.internal_encoding = UTF-8/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/;date.timezone =/date.timezone = Europe\/Paris/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/post_max_size = 8M/post_max_size = 50M/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/session.gc_maxlifetime = 1440/session.gc_maxlifetime = 86400/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/;opcache.enable=0/opcache.enable=1/g' /etc/php/7.2/fpm/php.ini \
&& sed -i -e "s/;opcache.memory_consumption=64/opcache.memory_consumption=128/g" /etc/php/7.2/fpm/php.ini \
&& sed -i -e "s/;opcache.max_accelerated_files=2000/opcache.max_accelerated_files=10000/g" /etc/php/7.2/fpm/php.ini \
&& sed -i -e 's/^listen =.*/listen = 9000/g' /etc/php/7.2/fpm/pool.d/www.conf \
&& sed -i -e 's/^user = www-data/user = fpm/g' /etc/php/7.2/fpm/pool.d/www.conf \
&& sed -i -e 's/^group = www-data/group = fpm/g' /etc/php/7.2/fpm/pool.d/www.conf \
&& touch /var/log/php7.2-fpm.log && mkdir /run/php \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& echo "Europe/Paris" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
COPY composer-install.sh /
COPY entrypoint.sh /
RUN chmod +x /composer-install.sh
RUN chmod +x /entrypoint.sh
# Add VOLUMEs
VOLUME ["/home/vhosts"]
ENTRYPOINT ["/entrypoint.sh"]
# Expose and Run
EXPOSE 9000
CMD ["php-fpm7.2", "-F"]

View File

@ -0,0 +1,17 @@
#!/usr/bin/env sh
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --filename=composer --install-dir=/usr/local/bin --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT

View File

@ -0,0 +1,12 @@
#!/bin/bash
# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback
USER_ID=${LOCAL_USER_ID:-9001}
echo "FPM USER ID : $USER_ID"
useradd --shell /bin/bash -u $USER_ID -o -c "" -m fpm
exec "$@"