Optimize php-fpm and workspace Dockerfile. (#2015)

This commit is contained in:
Shao Yu-Lung (Allen) 2019-02-23 16:46:46 +08:00 committed by GitHub
parent cde20c3ced
commit 61d7b18922
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 62 deletions

View File

@ -24,27 +24,27 @@ ARG LARADOCK_PHP_VERSION
ENV DEBIAN_FRONTEND noninteractive
# always run apt update when start and after add new source list, then clean up at end.
RUN set -xe && apt-get update -yqq && \
apt-get install -y apt-utils && \
pecl channel-update pecl.php.net
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
# are installed on the base image 'laradock/php-fpm' image. If you want
# to add more Software's or remove existing one, you need to edit the
# base image (https://github.com/Laradock/php-fpm).
#
# next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
USER root
RUN apt-get install libzip-dev zip unzip -y && \
RUN set -xe; \
apt-get update -yqq && \
pecl channel-update pecl.php.net && \
apt-get install -yqq \
apt-utils \
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
# are installed on the base image 'laradock/php-fpm' image. If you want
# to add more Software's or remove existing one, you need to edit the
# base image (https://github.com/Laradock/php-fpm).
#
# next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
libzip-dev zip unzip && \
docker-php-ext-configure zip --with-libzip && \
# Install the zip extension
docker-php-ext-install zip
docker-php-ext-install zip && \
php -m | grep -q 'zip'
#
#--------------------------------------------------------------------------
@ -340,7 +340,8 @@ USER root
ARG INSTALL_AEROSPIKE=false
RUN set -xe && if [ ${INSTALL_AEROSPIKE} = true ]; then \
RUN set -xe; \
if [ ${INSTALL_AEROSPIKE} = true ]; then \
# Fix dependencies for PHPUnit within aerospike extension
apt-get -y install sudo wget && \
# Install the php aerospike extension
@ -455,7 +456,8 @@ RUN if [ ${INSTALL_LDAP} = true ]; then \
ARG INSTALL_MSSQL=false
RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
RUN set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
apt-get -y install freetds-dev libsybdb5 \
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
@ -487,7 +489,7 @@ RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
&& php -m | grep -q 'pdo_sqlsrv' \
&& php -m | grep -q 'sqlsrv' \
;fi \
;fi
;fi
###########################################################################
# Image optimizers:
@ -628,7 +630,7 @@ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
# Check PHP version:
###########################################################################
RUN php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
#
#--------------------------------------------------------------------------

View File

@ -37,28 +37,31 @@ ARG PGID=1000
ENV PGID ${PGID}
# always run apt update when start and after add new source list, then clean up at end.
RUN set -xe && apt-get update -yqq && \
RUN set -xe; \
apt-get update -yqq && \
pecl channel-update pecl.php.net && \
groupadd -g ${PGID} laradock && \
useradd -u ${PUID} -g laradock -m laradock -G docker_env && \
usermod -p "*" laradock -s /bin/bash
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("php-cli", "git", "vim", ....) are
# installed on the base image 'laradock/workspace' image. If you want
# to add more Software's or remove existing one, you need to edit the
# base image (https://github.com/Laradock/workspace).
#
# next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
USER root
RUN apt-get install -y libzip-dev zip unzip \
usermod -p "*" laradock -s /bin/bash && \
apt-get install -yqq \
apt-utils \
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("php-cli", "git", "vim", ....) are
# installed on the base image 'laradock/workspace' image. If you want
# to add more Software's or remove existing one, you need to edit the
# base image (https://github.com/Laradock/workspace).
#
# next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
libzip-dev zip unzip \
# Install the zip extension
php${LARADOCK_PHP_VERSION}-zip
php${LARADOCK_PHP_VERSION}-zip \
# nasm
nasm && \
php -m | grep -q 'zip'
#
#--------------------------------------------------------------------------
@ -583,7 +586,8 @@ USER root
ARG INSTALL_AEROSPIKE=false
RUN set -xe && if [ ${INSTALL_AEROSPIKE} = true ]; then \
RUN set -xe; \
if [ ${INSTALL_AEROSPIKE} = true ]; then \
# Fix dependencies for PHPUnit within aerospike extension
apt-get -y install sudo wget && \
# Install the php aerospike extension
@ -614,7 +618,7 @@ RUN set -xe && if [ ${INSTALL_AEROSPIKE} = true ]; then \
&& echo 'extension=aerospike.so' >> /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/aerospike.ini \
&& echo 'aerospike.udf.lua_system_path=/usr/local/aerospike/lua' >> /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/aerospike.ini \
&& echo 'aerospike.udf.lua_user_path=/usr/local/aerospike/usr-lua' >> /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/aerospike.ini \
;fi
;fi
###########################################################################
# PHP V8JS:
@ -624,7 +628,8 @@ USER root
ARG INSTALL_V8JS=false
RUN set -xe && if [ ${INSTALL_V8JS} = true ]; then \
RUN set -xe; \
if [ ${INSTALL_V8JS} = true ]; then \
add-apt-repository -y ppa:pinepain/libv8-archived \
&& apt-get update -yqq \
&& apt-get install -y libv8-5.4 && \
@ -635,7 +640,7 @@ RUN set -xe && if [ ${INSTALL_V8JS} = true ]; then \
fi \
&& echo "extension=v8js.so" >> /etc/php/${LARADOCK_PHP_VERSION}/cli/php.ini \
&& php -m | grep -q 'v8js' \
;fi
;fi
###########################################################################
# Laravel Envoy:
@ -733,7 +738,8 @@ RUN if [ ${INSTALL_LINUXBREW} = true ]; then \
ARG INSTALL_MSSQL=false
RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
RUN set -eux; \
if [ ${INSTALL_MSSQL} = true ]; then \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
apt-get -y install php5.6-sybase freetds-bin freetds-common libsybdb5 \
&& php -m | grep -q 'mssql' \
@ -761,7 +767,7 @@ RUN set -eux; if [ ${INSTALL_MSSQL} = true ]; then \
&& php -m | grep -q 'sqlsrv' \
&& php -m | grep -q 'pdo_sqlsrv' \
;fi \
;fi
;fi
###########################################################################
# Minio:
@ -871,15 +877,6 @@ RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
&& apt-get -y install postgresql-client-10 \
;fi
###########################################################################
# nasm
###########################################################################
USER root
RUN apt-get update -yqq \
&& apt-get -yqq install nasm
###########################################################################
# Dusk Dependencies:
###########################################################################
@ -942,7 +939,7 @@ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
# Check PHP version:
###########################################################################
RUN php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
#
#--------------------------------------------------------------------------