reorder dockerfile to install all at the start
This commit is contained in:
parent
3d8fee13e1
commit
5bee06a4e7
1 changed files with 32 additions and 44 deletions
|
|
@ -5,25 +5,45 @@ ARG WKHTML=""
|
|||
|
||||
RUN apt-get update -y
|
||||
RUN apt-get upgrade -y
|
||||
RUN apt-get install -y --no-install-recommends ca-certificates curl apt-transport-https lsb-release readline-common git zlib1g-dev
|
||||
|
||||
# PHP files based on PHP_VERSION
|
||||
RUN curl -L https://packages.sury.org/php/apt.gpg -o /etc/apt/trusted.gpg.d/php.gpg
|
||||
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
|
||||
RUN apt-get update -y
|
||||
|
||||
# persistent / runtime deps
|
||||
RUN apt-get install -y --no-install-recommends ca-certificates curl apt-transport-https lsb-release imagemagick
|
||||
RUN apt-get install -y --no-install-recommends imagemagick apache2 msmtp msmtp-mta \
|
||||
php${PHP_VERSION} php${PHP_VERSION}-bcmath php${PHP_VERSION}-cli php${PHP_VERSION}-common \
|
||||
php${PHP_VERSION}-curl php${PHP_VERSION}-fpm php${PHP_VERSION}-gd php${PHP_VERSION}-gmp \
|
||||
php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring \
|
||||
php${PHP_VERSION}-mysql php${PHP_VERSION}-opcache php${PHP_VERSION}-readline php${PHP_VERSION}-sqlite3 \
|
||||
php${PHP_VERSION}-xml php${PHP_VERSION}-yaml php${PHP_VERSION}-zip php${PHP_VERSION}-apcu \
|
||||
libapache2-mod-php${PHP_VERSION}
|
||||
|
||||
RUN set -eux; [ ! -d /var/www/html ]; mkdir -p /var/www/html; chown www-data:www-data /var/www/html; chmod 1777 /var/www/html
|
||||
# specific PHP modules for some versions
|
||||
RUN if [[ "${PHP_VERSION}" == "7.4" ]] ; then apt-get -y install php${PHP_VERSION}-json; fi
|
||||
|
||||
# install wkhtml if needed
|
||||
RUN if [[ "${WKHTML}" != "" ]] ; then \
|
||||
apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev fontconfig libfreetype6 libjpeg62-turbo \
|
||||
libpng16-16 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi xfonts-base; \
|
||||
curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb -o /tmp/wkhtmltox.deb; \
|
||||
dpkg -i /tmp/wkhtmltox.deb; \
|
||||
fi
|
||||
|
||||
# upgrade system a second time
|
||||
RUN apt-get upgrade -y
|
||||
|
||||
# clean all
|
||||
RUN rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN mkdir -p /var/www/html; chown www-data:www-data /var/www/html; chmod 1777 /var/www/html
|
||||
|
||||
ENV APACHE_CONFDIR=/etc/apache2
|
||||
ENV APACHE_ENVVARS=$APACHE_CONFDIR/envvars
|
||||
|
||||
RUN set -eux; \
|
||||
apt-get install -y --no-install-recommends apache2; \
|
||||
\
|
||||
# generically convert lines like
|
||||
# export APACHE_RUN_USER=www-data
|
||||
# into
|
||||
# : ${APACHE_RUN_USER:=www-data}
|
||||
# export APACHE_RUN_USER
|
||||
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
|
||||
sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
|
||||
RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \
|
||||
\
|
||||
# setup directories and permissions
|
||||
. "$APACHE_ENVVARS"; \
|
||||
|
|
@ -48,29 +68,6 @@ RUN set -eux; \
|
|||
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
|
||||
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"
|
||||
|
||||
# PHP files based on PHP_VERSION
|
||||
RUN curl -L https://packages.sury.org/php/apt.gpg -o /etc/apt/trusted.gpg.d/php.gpg
|
||||
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install readline-common git zlib1g-dev \
|
||||
php${PHP_VERSION} php${PHP_VERSION}-bcmath php${PHP_VERSION}-cli php${PHP_VERSION}-common \
|
||||
php${PHP_VERSION}-curl php${PHP_VERSION}-fpm php${PHP_VERSION}-gd php${PHP_VERSION}-gmp \
|
||||
php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring \
|
||||
php${PHP_VERSION}-mysql php${PHP_VERSION}-opcache php${PHP_VERSION}-readline php${PHP_VERSION}-sqlite3 \
|
||||
php${PHP_VERSION}-xml php${PHP_VERSION}-yaml php${PHP_VERSION}-zip php${PHP_VERSION}-apcu \
|
||||
libapache2-mod-php${PHP_VERSION}
|
||||
|
||||
# specific PHP modules for some versions
|
||||
RUN if [[ "${PHP_VERSION}" == "7.4" ]] ; then apt-get -y install php${PHP_VERSION}-json; fi
|
||||
|
||||
# install wkhtml if needed
|
||||
RUN if [[ "${WKHTML}" != "" ]] ; then \
|
||||
apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev fontconfig libfreetype6 libjpeg62-turbo \
|
||||
libpng16-16 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi xfonts-base; \
|
||||
curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb -o /tmp/wkhtmltox.deb; \
|
||||
dpkg -i /tmp/wkhtmltox.deb; \
|
||||
fi
|
||||
|
||||
# symbolic link for easy use of php.ini
|
||||
RUN ln -s /etc/php/${PHP_VERSION}/apache2/conf.d /etc/php/conf.d
|
||||
|
||||
|
|
@ -87,15 +84,6 @@ RUN a2enmod remoteip
|
|||
RUN a2enmod setenvif
|
||||
RUN a2ensite site
|
||||
|
||||
# upgrade system a second time
|
||||
RUN apt-get upgrade -y
|
||||
|
||||
# email relay
|
||||
RUN apt-get install -y --no-install-recommends msmtp msmtp-mta
|
||||
|
||||
# clean all
|
||||
RUN rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/*
|
||||
|
||||
# apache init
|
||||
COPY apache/apache2-foreground /usr/local/bin/apache2-foreground
|
||||
RUN chmod +x /usr/local/bin/apache2-foreground
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue