Skip to content

Instantly share code, notes, and snippets.

@alwinkpc
Created April 16, 2019 16:07
Show Gist options
  • Save alwinkpc/49f0510ff1bb881988e2952f0b600c5c to your computer and use it in GitHub Desktop.
Save alwinkpc/49f0510ff1bb881988e2952f0b600c5c to your computer and use it in GitHub Desktop.
php:7.1-apache container with gd iconv intl mcrypt pdo_mysql pdo_sqlsvr pcntl zip and composer
FROM php:7.1-apache
RUN echo "deb http://deb.debian.org/debian jessie main" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/debian-security jessie/updates main" >> /etc/apt/sources.list && \
echo "deb http://deb.debian.org/debian jessie-updates main" >> /etc/apt/sources.list && \
apt-get -yqq update && \
apt-get -yqq install \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libmcrypt-dev \
libicu-dev \
wget \
apt-utils \
apt-transport-https \
gnupg2 && \
apt-get install -yqq --no-install-recommends curl libc6 g++ libssl1.0 && \
curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl -s https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update -yqq && \
# libraries
docker-php-source extract && \
docker-php-ext-install -j$(nproc) gd iconv intl mcrypt pdo_mysql pcntl zip && \
docker-php-ext-configure gd --with-freetype-dir --with-jpeg-dir --with-png-dir && \
docker-php-source delete && \
a2enmod rewrite && \
# xdebug
pecl install xdebug-2.6.0 && \
docker-php-ext-enable xdebug && \
# Sqlsvr
ACCEPT_EULA=Y apt-get install -y --no-install-recommends unixodbc odbcinst1debian2 unixodbc-dev msodbcsql17 mssql-tools && \
pecl install pdo_sqlsrv && \
docker-php-ext-enable pdo_sqlsrv && \
# Composer
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")" && \
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then \
>&2 echo 'ERROR: Invalid installer signature' \
exit 1; \
fi && \
php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet && \
RESULT=$? && \
rm composer-setup.php && \
if [ "$RESULT" != 0 ]; then \
>&2 echo 'ERROR: Composer setup' \
exit $RESULT; \
fi && \
# cleaup
apt-get remove -y \
unixodbc-dev \
curl \
g++ \
wget \
apt-utils \
apt-transport-https \
gnupg2 && \
rm -rf /var/lib/apt/lists/* && \
rm /etc/apt/sources.list.d/mssql-release.list
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
COPY ./php.ini /usr/local/etc/php
COPY ./sites-enabled.conf /etc/apache2/sites-enabled/000-default.conf
RUN adduser owner && usermod -a -G www-data owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment