Skip to content

Instantly share code, notes, and snippets.

@fuongz
Created November 19, 2019 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuongz/1b941ee42b3241b9670126cdfba73156 to your computer and use it in GitHub Desktop.
Save fuongz/1b941ee42b3241b9670126cdfba73156 to your computer and use it in GitHub Desktop.
PHP Dockerfile with xdebug, redis, apcu enabled
FROM php:7.1.33-alpine3.10
LABEL version="1.0.0",maintainer="phuongthephung@gmail.com"
RUN apk update; \
apk upgrade; \
apk add --no-cache \
$PHPIZE_DEPS openssl ca-certificates curl tzdata autoconf gcc icu-dev libmcrypt-dev freetype-dev jpeg-dev libjpeg-turbo-dev libwebp-dev libpng-dev libxpm-dev bzip2-dev
RUN docker-php-ext-configure intl \
&& docker-php-ext-configure gd \
--with-gd --with-webp-dir --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
--with-png-dir --with-zlib-dir --with-xpm-dir \
--enable-gd-native-ttf \
&& docker-php-ext-install \
iconv \
mcrypt \
intl \
pdo \
pdo_mysql \
mbstring \
opcache \
zip \
gd \
exif \
bz2
ARG XDEBUG_VERSION=2.7.2
ARG REDIS_VERSION=5.0.1
ARG APCU_VERSION=5.1.17
ARG APCU_BC_VERSION=1.0.5
RUN pecl install xdebug-$XDEBUG_VERSION \
&& docker-php-ext-enable xdebug \
&& pecl install redis-$REDIS_VERSION \
&& docker-php-ext-enable redis \
&& pecl install apcu-$APCU_VERSION \
&& docker-php-ext-enable apcu \
&& pecl install apcu_bc-$APCU_BC_VERSION \
&& docker-php-ext-enable apc
RUN rm -f /usr/local/etc/php/conf.d/docker-php-ext-apc.ini \
&& rm -f /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini
COPY conf/*.ini /usr/local/etc/php/conf.d/
RUN apk del --purge autoconf gcc
RUN rm -rf /var/cache/apk/* && \
rm -rf /tmp/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment