Skip to content

Instantly share code, notes, and snippets.

@scry3r
Last active October 26, 2017 12:45
Show Gist options
  • Save scry3r/b264d88873a21dcba04252dfbfadc9c5 to your computer and use it in GitHub Desktop.
Save scry3r/b264d88873a21dcba04252dfbfadc9c5 to your computer and use it in GitHub Desktop.
PHP with extension
FROM php:7.0-fpm
# Get repository and install wget and vim
RUN apt-get update && apt-get install --no-install-recommends -y \
wget \
emacs \
git \
unzip
# Add PostgreSQL repository
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -
# Install PHP extensions deps
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
postgresql-server-dev-9.5 \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
zlib1g-dev \
libicu-dev \
g++ \
unixodbc-dev \
libxml2-dev \
libaio-dev \
libmemcached-dev \
freetds-dev \
libssl-dev \
libgpgme11-dev \
openssl
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- \
--install-dir=/usr/local/bin \
--filename=composer
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \
&& pecl install sqlsrv-4.1.6.1 \
&& pecl install pdo_sqlsrv-4.1.6.1 \
&& pecl install redis \
&& pecl install memcached \
&& pecl install gnupg \
&& docker-php-ext-install \
iconv \
mbstring \
intl \
mcrypt \
gd \
pgsql \
mysqli \
pdo_mysql \
pdo_pgsql \
pdo_dblib \
soap \
sockets \
zip \
pcntl \
ftp \
&& docker-php-ext-enable \
sqlsrv \
pdo_sqlsrv \
redis \
memcached \
gnupg \
opcache
# Install APCu and APC backward compatibility
RUN pecl install apcu \
&& pecl install apcu_bc-1.0.3 \
&& docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini \
&& docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
# Install PHPUnit
RUN wget https://phar.phpunit.de/phpunit.phar -O /usr/local/bin/phpunit \
&& chmod +x /usr/local/bin/phpunit
# Clean repository
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment