Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 102 additions & 102 deletions 7.2/buster/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,166 +1,166 @@
FROM php:7.2.26-apache-buster
LABEL com.bmeme.project.family='PHP Docker Image' \
com.bmeme.project.version='7.2.26-apache-buster' \
com.bmeme.maintainer.1='Daniele Piaggesi <daniele.piaggesi@bmeme.com>' \
com.bmeme.maintainer.2='Roberto Mariani <roberto.mariani@bmeme.com>' \
com.bmeme.refreshedat='2021-12-26'
com.bmeme.project.version='7.2.26-apache-buster' \
com.bmeme.maintainer.1='Daniele Piaggesi <daniele.piaggesi@bmeme.com>' \
com.bmeme.maintainer.2='Roberto Mariani <roberto.mariani@bmeme.com>' \
com.bmeme.refreshedat='2021-12-26'

# Variables
ENV COMPOSER_HOME=/var/www/.composer \
# @see https://getcomposer.org/download/
COMPOSER_VERSION='1.9.2' \
TIMEZONE=Europe/Rome
# @see https://getcomposer.org/download/
COMPOSER_VERSION='1.9.2' \
TIMEZONE=Europe/Rome

# Program version variables
ENV IGBINARY_VERSION=3.1.0 \
MCRYPT_VERSION=1.0.3 \
OAUTH_VERSION=2.0.4 \
REDIS_VERSION=5.1.1
MCRYPT_VERSION=1.0.3 \
OAUTH_VERSION=2.0.4 \
REDIS_VERSION=5.1.1

# PHP environment variables
ENV PHP_MEMORY_LIMIT=512M \
PHP_MAX_EXECUTION_TIME=60 \
PHP_LOG_ENABLED=1 \
PHP_ERROR_LOG=/tmp/php_errors.log \
PHP_UPLOAD_MAX_FILESIZE=20M \
PHP_POST_MAX_SIZE=20M \
PHP_SENDMAIL=/usr/local/sendmail
PHP_MAX_EXECUTION_TIME=60 \
PHP_LOG_ENABLED=1 \
PHP_ERROR_LOG=/tmp/php_errors.log \
PHP_UPLOAD_MAX_FILESIZE=20M \
PHP_POST_MAX_SIZE=20M \
PHP_SENDMAIL=/usr/local/sendmail

# OPCACHE environment variables
ENV OPCACHE_ENABLED=1 \
OPCACHE_MEMORY_CONSUMPTION=128 \
OPCACHE_INTERNED_STRINGS_BUFFER=8 \
OPCACHE_MAX_ACCELERATED_FILES=4000 \
OPCACHE_REVALIDATE_FREQ=60 \
OPCACHE_FAST_SHUTDOWN=1
OPCACHE_MEMORY_CONSUMPTION=128 \
OPCACHE_INTERNED_STRINGS_BUFFER=8 \
OPCACHE_MAX_ACCELERATED_FILES=4000 \
OPCACHE_REVALIDATE_FREQ=60 \
OPCACHE_FAST_SHUTDOWN=1

ENV PERSISTENT_PROGRAMS \
git \
default-mysql-client \
patch \
python3 \
python3-distutils \
tzdata \
unzip \
vim \
zip
ENV PERSISTENT_PROGRAMS="\
git \
default-mysql-client \
patch \
python3 \
tzdata \
unzip \
vim \
zip \
"

# install the PHP extensions we need
RUN set -eux; \
\
if command -v a2enmod; then \
a2enmod rewrite; \
a2enmod rewrite; \
fi; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
${PHPIZE_DEPS} \
${PERSISTENT_PROGRAMS} \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpcre3-dev \
libpng-dev \
libpq-dev \
libzip-dev \
${PHPIZE_DEPS} \
${PERSISTENT_PROGRAMS} \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpcre3-dev \
libpng-dev \
libpq-dev \
libzip-dev \
; \
\
pecl install \
mcrypt-${MCRYPT_VERSION} \
igbinary-${IGBINARY_VERSION} \
oauth-${OAUTH_VERSION} \
mcrypt-${MCRYPT_VERSION} \
igbinary-${IGBINARY_VERSION} \
oauth-${OAUTH_VERSION} \
; \
\
# See https://github.com/phpredis/phpredis/issues/1176#issuecomment-558787347
pecl bundle --destination=/usr/src/php/ext redis-${REDIS_VERSION}; \
\
docker-php-ext-configure gd \
--with-freetype-dir=/usr \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-freetype-dir=/usr \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
; \
docker-php-ext-configure intl; \
docker-php-ext-configure zip \
--with-libzip; \
--with-libzip; \
docker-php-ext-configure redis \
--enable-redis-igbinary \
--enable-redis-lzf \
--enable-redis-igbinary \
--enable-redis-lzf \
;\
\
docker-php-ext-enable \
mcrypt \
igbinary \
oauth \
mcrypt \
igbinary \
oauth \
; \
\
docker-php-ext-install -j "$(nproc)" \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
pdo_pgsql \
redis \
sockets \
zip \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
pdo_pgsql \
redis \
sockets \
zip \
; \
\
# install composer
mkdir ${COMPOSER_HOME}; \
curl -k -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --version=${COMPOSER_VERSION} --filename=composer; \
# install ansible
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; \
python3 get-pip.py; \
pip install ansible; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
# install composer
mkdir ${COMPOSER_HOME}; \
curl -k -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --version=${COMPOSER_VERSION} --filename=composer; \
# install ansible
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py; \
python3 get-pip.py; \
pip install ansible; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual ${savedAptMark}; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-mark manual ${PERSISTENT_PROGRAMS}; \
apt-mark manual ${PERSISTENT_PROGRAMS}; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
# remove php source
docker-php-source delete
# remove php source
docker-php-source delete

RUN set -eux; \
# set localtime and timezone
rm /etc/localtime; \
cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime; \
echo "${TIMEZONE}" > /etc/timezone; \
\
# set application ini settings
{ \
echo 'date.timezone = ${TIMEZONE}'; \
echo 'error_log = ${PHP_ERROR_LOG}'; \
echo 'log_errors = ${PHP_LOG_ENABLED}'; \
echo 'max_execution_time = ${PHP_MAX_EXECUTION_TIME}'; \
echo 'memory_limit = ${PHP_MEMORY_LIMIT}'; \
echo 'post_max_size = ${PHP_POST_MAX_SIZE}'; \
echo 'sendmail_path = ${PHP_SENDMAIL}'; \
echo 'upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}'; \
echo "${TIMEZONE}" > /etc/timezone; \
\
# set application ini settings
{ \
echo 'date.timezone = ${TIMEZONE}'; \
echo 'error_log = ${PHP_ERROR_LOG}'; \
echo 'log_errors = ${PHP_LOG_ENABLED}'; \
echo 'max_execution_time = ${PHP_MAX_EXECUTION_TIME}'; \
echo 'memory_limit = ${PHP_MEMORY_LIMIT}'; \
echo 'post_max_size = ${PHP_POST_MAX_SIZE}'; \
echo 'sendmail_path = ${PHP_SENDMAIL}'; \
echo 'upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}'; \
} > /usr/local/etc/php/conf.d/application.ini; \
\
# set opcache ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
{ \
echo 'opcache.enable = ${OPCACHE_ENABLED}'; \
echo 'opcache.memory_consumption = ${OPCACHE_MEMORY_CONSUMPTION}'; \
echo 'opcache.interned_strings_buffer = ${OPCACHE_INTERNED_STRINGS_BUFFER}'; \
echo 'opcache.max_accelerated_files = ${OPCACHE_MAX_ACCELERATED_FILES}'; \
echo 'opcache.revalidate_freq = ${OPCACHE_REVALIDATE_FREQ}'; \
echo 'opcache.fast_shutdown = ${OPCACHE_FAST_SHUTDOWN}'; \
# set opcache ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
{ \
echo 'opcache.enable = ${OPCACHE_ENABLED}'; \
echo 'opcache.memory_consumption = ${OPCACHE_MEMORY_CONSUMPTION}'; \
echo 'opcache.interned_strings_buffer = ${OPCACHE_INTERNED_STRINGS_BUFFER}'; \
echo 'opcache.max_accelerated_files = ${OPCACHE_MAX_ACCELERATED_FILES}'; \
echo 'opcache.revalidate_freq = ${OPCACHE_REVALIDATE_FREQ}'; \
echo 'opcache.fast_shutdown = ${OPCACHE_FAST_SHUTDOWN}'; \
} > /usr/local/etc/php/conf.d/opcache.ini; \
\
# inject index.php
Expand Down
Loading