mirror of
https://github.com/chialab/docker-php.git
synced 2026-08-24 02:24:16 -05:00
79 lines
2.9 KiB
Docker
79 lines
2.9 KiB
Docker
ARG BASE_IMAGE=php:latest
|
|
FROM ${BASE_IMAGE}
|
|
LABEL maintainer="dev@chialab.io"
|
|
|
|
# Fix Debian 9 (Stretch) and 10 (Buster) source lists, because they have been moved to archive
|
|
# Paranoid people should manually download and verify the signing keys from https://ftp-master.debian.org/keys.html
|
|
RUN if [ "$(grep '^VERSION_ID=' /etc/os-release | cut -d '=' -f 2 | tr -d '"')" -lt "11" ]; then \
|
|
sed -i -e 's/deb.debian.org/archive.debian.org/g' \
|
|
-e 's/security.debian.org/archive.debian.org/g' \
|
|
-e '/stretch-updates/d' \
|
|
-e '/buster-updates/d' /etc/apt/sources.list; \
|
|
apt-get update && apt-get install -y --allow-unauthenticated debian-archive-keyring; \
|
|
fi
|
|
|
|
# Download script to install PHP extensions and dependencies
|
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
|
|
|
|
RUN chmod +x /usr/local/bin/install-php-extensions
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update -q \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y \
|
|
curl \
|
|
git \
|
|
zip unzip \
|
|
# iconv, mbstring and pdo_sqlite are omitted as they are already installed
|
|
&& PHP_EXTENSIONS=" \
|
|
amqp \
|
|
bcmath \
|
|
bz2 \
|
|
calendar \
|
|
event \
|
|
exif \
|
|
gd \
|
|
gettext \
|
|
imagick \
|
|
intl \
|
|
ldap \
|
|
memcached \
|
|
mysqli \
|
|
opcache \
|
|
pdo_mysql \
|
|
pdo_pgsql \
|
|
pgsql \
|
|
redis \
|
|
soap \
|
|
sockets \
|
|
xsl \
|
|
zip \
|
|
" \
|
|
&& case "$PHP_VERSION" in \
|
|
5.6.*) PHP_EXTENSIONS="$PHP_EXTENSIONS mcrypt mysql";; \
|
|
7.0.*|7.1.*) PHP_EXTENSIONS="$PHP_EXTENSIONS mcrypt";; \
|
|
esac \
|
|
# On PHP Debian 9 (Stretch) amqp has a dependency on libssh-dev, which pulls in
|
|
# libssl1.0-dev, which conflicts with the libssl-dev version (1.1.0) needed by the
|
|
# other extensions. Installing amqp on its own so that install-php-extensions
|
|
# purges libssl1.0-dev before libssl-dev is installed for the rest.
|
|
&& if [ "${PHP_VERSION%%.*}" = "7" ]; then \
|
|
install-php-extensions amqp \
|
|
&& install-php-extensions $(echo "$PHP_EXTENSIONS" | sed 's/amqp//'); \
|
|
else \
|
|
install-php-extensions $PHP_EXTENSIONS; \
|
|
fi \
|
|
&& if command -v a2enmod; then a2enmod rewrite; fi
|
|
|
|
# Install Composer.
|
|
ENV PATH=$PATH:/root/composer/vendor/bin \
|
|
COMPOSER_ALLOW_SUPERUSER=1 \
|
|
COMPOSER_HOME=/root/composer
|
|
RUN cd /opt \
|
|
# Download installer and check for its integrity.
|
|
&& curl -sSL https://getcomposer.org/installer > composer-setup.php \
|
|
&& curl -sSL https://composer.github.io/installer.sha384sum > composer-setup.sha384sum \
|
|
&& sha384sum --check composer-setup.sha384sum \
|
|
# Install Composer 2.
|
|
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --2 \
|
|
# Remove installer files.
|
|
&& rm /opt/composer-setup.php /opt/composer-setup.sha384sum
|