Skip to content

Instantly share code, notes, and snippets.

@sammyd
Created February 8, 2017 11:21
Show Gist options
  • Save sammyd/7f467d585e2ac103b13dd04b429c87b2 to your computer and use it in GitHub Desktop.
Save sammyd/7f467d585e2ac103b13dd04b429c87b2 to your computer and use it in GitHub Desktop.
WIP PHP Dockerfile
FROM php:5.6-fpm
MAINTAINER Sam Davies <sam@razeware.com>
# Add the required PHP extensions
RUN set -ex \
&& apt-get update \
&& apt-get install -y libjpeg-dev libpng12-dev git wget --no-install-recommends \
&& rm -r /var/lib/apt/lists/* \
&& echo '' | pecl install apcu-4.0.11 redis \
&& docker-php-ext-enable apcu redis \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd mysqli opcache pdo_mysql
# Install tideways extension
RUN git clone https://github.com/tideways/php-profiler-extension /usr/src/php/ext/tideways \
&& wget https://github.com/tideways/profiler/releases/download/v2.0.14/Tideways.php \
&& mv Tideways.php /usr/local/lib/php/extensions/no-debug-non-zts-20131226 \
&& docker-php-ext-configure /usr/src/php/ext/tideways \
&& docker-php-ext-install /usr/src/php/ext/tideways
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# Configure the main working directory. This is the base
# directory used in any further RUN, COPY, and ENTRYPOINT
# commands.
RUN mkdir -p /var/www/koenig
WORKDIR /var/www/koenig
# Install WP-CLI
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/bin/wp-cli
# Add the config file
ADD ./docker/usr/local/etc/php/php.ini /usr/local/etc/php/php.ini
# Finally, add all the source code
COPY . ./
...
[tideways]
tideways.udp_connection="tideways:8135"
tideways.connection="tcp://tideways:9135"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment