PHP 7.1 Dockerfile
FROM php:7.1.9-fpm# Install any custom system requirements hereRUN apt-get update \&& apt-get install -y --no-install-recommends \curl \libicu-dev \libmemcached-dev \...
·
FROM php:7.1.9-fpm
# Install any custom system requirements here
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libicu-dev \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng12-dev \
libfreetype6-dev \
libssl-dev \
libmcrypt-dev \
libxml2-dev \
libbz2-dev \
libjpeg62-turbo-dev \
php-pear \
curl \
git \
subversion \
&& rm -rf /var/lib/apt/lists/*
# Install various PHP extensions
RUN docker-php-ext-configure bcmath --enable-bcmath \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql \
&& docker-php-ext-configure pdo_pgsql --with-pgsql \
&& docker-php-ext-configure mbstring --enable-mbstring \
&& docker-php-ext-configure soap --enable-soap \
&& docker-php-ext-install \
bcmath \
intl \
mbstring \
mcrypt \
mysqli \
pcntl \
pdo_mysql \
pdo_pgsql \
soap \
sockets \
zip \
&& docker-php-ext-configure gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/lib \
--with-freetype-dir=/usr/include/freetype2 && \
docker-php-ext-install gd \
&& docker-php-ext-install opcache \
&& docker-php-ext-enable opcache
# AST
RUN git clone https://github.com/nikic/php-ast /usr/src/php/ext/ast/ && \
docker-php-ext-configure ast && \
docker-php-ext-install ast
# ICU - intl requirements for Symfony
# Debian is out of date, and Symfony expects the latest - so build from source, unless a better alternative exists(?)
RUN curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.tgz \
&& tar -zxf /tmp/icu.tar.gz -C /tmp \
&& cd /tmp/icu/source \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
RUN docker-php-ext-configure intl --with-icu-dir=/usr/local \
&& docker-php-ext-install intl
# Install the php memcached extension
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
&& mkdir -p memcached \
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
&& ( \
cd memcached \
&& phpize \
&& ./configure \
&& make -j$(nproc) \
&& make install \
) \
&& rm -r memcached \
&& rm /tmp/memcached.tar.gz \
&& docker-php-ext-enable memcached
# Copy opcache configration
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# Install xDebug, if enabled
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension
pecl install xdebug && \
docker-php-ext-enable xdebug \
;fi
# Copy xdebug configration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
# Copy timezone configration
COPY ./timezone.ini /usr/local/etc/php/conf.d/timezone.ini
# Set timezone
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
RUN "date"
# Short open tags fix - another Symfony requirements
COPY ./custom-php.ini /usr/local/etc/php/conf.d/custom-php.ini
# Composer
ENV COMPOSER_HOME /var/www/.composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/bin \
--filename=composer
RUN chown -R www-data:www-data /var/www/
RUN mkdir -p $COMPOSER_HOME/cache
VOLUME $COMPOSER_HOME
docker build -t php7 .
更多推荐
已为社区贡献1条内容
所有评论(0)