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,10 +24,11 @@ ARG LARADOCK_PHP_VERSION
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# always run apt update when start and after add new source list, then clean up at end. # 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 install -y apt-utils && \ apt-get update -yqq && \
pecl channel-update pecl.php.net pecl channel-update pecl.php.net && \
apt-get install -yqq \
apt-utils \
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Mandatory Software's Installation # Mandatory Software's Installation
@ -39,12 +40,11 @@ RUN set -xe && apt-get update -yqq && \
# base image (https://github.com/Laradock/php-fpm). # 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 # next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
USER root libzip-dev zip unzip && \
RUN apt-get install libzip-dev zip unzip -y && \
docker-php-ext-configure zip --with-libzip && \ docker-php-ext-configure zip --with-libzip && \
# Install the zip extension # 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 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 # Fix dependencies for PHPUnit within aerospike extension
apt-get -y install sudo wget && \ apt-get -y install sudo wget && \
# Install the php aerospike extension # Install the php aerospike extension
@ -455,7 +456,8 @@ RUN if [ ${INSTALL_LDAP} = true ]; then \
ARG INSTALL_MSSQL=false 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 \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
apt-get -y install freetds-dev libsybdb5 \ apt-get -y install freetds-dev libsybdb5 \
&& ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \ && ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
@ -628,7 +630,7 @@ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
# Check PHP version: # 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,12 +37,14 @@ ARG PGID=1000
ENV PGID ${PGID} ENV PGID ${PGID}
# always run apt update when start and after add new source list, then clean up at end. # 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 && \ pecl channel-update pecl.php.net && \
groupadd -g ${PGID} laradock && \ groupadd -g ${PGID} laradock && \
useradd -u ${PUID} -g laradock -m laradock -G docker_env && \ useradd -u ${PUID} -g laradock -m laradock -G docker_env && \
usermod -p "*" laradock -s /bin/bash usermod -p "*" laradock -s /bin/bash && \
apt-get install -yqq \
apt-utils \
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Mandatory Software's Installation # Mandatory Software's Installation
@ -54,11 +56,12 @@ RUN set -xe && apt-get update -yqq && \
# base image (https://github.com/Laradock/workspace). # 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 # next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
USER root libzip-dev zip unzip \
RUN apt-get install -y libzip-dev zip unzip \
# Install the zip extension # 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 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 # Fix dependencies for PHPUnit within aerospike extension
apt-get -y install sudo wget && \ apt-get -y install sudo wget && \
# Install the php aerospike extension # Install the php aerospike extension
@ -624,7 +628,8 @@ USER root
ARG INSTALL_V8JS=false 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 \ add-apt-repository -y ppa:pinepain/libv8-archived \
&& apt-get update -yqq \ && apt-get update -yqq \
&& apt-get install -y libv8-5.4 && \ && apt-get install -y libv8-5.4 && \
@ -733,7 +738,8 @@ RUN if [ ${INSTALL_LINUXBREW} = true ]; then \
ARG INSTALL_MSSQL=false 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 \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
apt-get -y install php5.6-sybase freetds-bin freetds-common libsybdb5 \ apt-get -y install php5.6-sybase freetds-bin freetds-common libsybdb5 \
&& php -m | grep -q 'mssql' \ && php -m | grep -q 'mssql' \
@ -871,15 +877,6 @@ RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
&& apt-get -y install postgresql-client-10 \ && apt-get -y install postgresql-client-10 \
;fi ;fi
###########################################################################
# nasm
###########################################################################
USER root
RUN apt-get update -yqq \
&& apt-get -yqq install nasm
########################################################################### ###########################################################################
# Dusk Dependencies: # Dusk Dependencies:
########################################################################### ###########################################################################
@ -942,7 +939,7 @@ RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
# Check PHP version: # 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}."
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------