Skip to content

Instantly share code, notes, and snippets.

@Stoakes
Created December 15, 2018 11:55
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 Stoakes/2dcda4de69c9053ea4496e22d27339f3 to your computer and use it in GitHub Desktop.
Save Stoakes/2dcda4de69c9053ea4496e22d27339f3 to your computer and use it in GitHub Desktop.
FROM php:7.3-apache
# PHP extensions
ENV APCU_VERSION 5.1.11
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN buildDeps=" \
libicu-dev \
zlib1g-dev \
libzip-dev \
bzip2 \
wget\
" \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
$buildDeps \
libicu57 \
zlib1g \
libzip4 \
git \
fontconfig \
unzip \
&& wget https://raw.githubusercontent.com/n7consulting/phantomjs-build/master/phantomjs-2.1.1-linux-x86_64.tar.bz2 \
&& tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 \
&& mv phantomjs-2.1.1-linux-x86_64 /usr/local/bin \
&& ln -sf /usr/local/bin/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin \
&& phantomjs --version \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install \
intl \
mbstring \
pdo_mysql \
zip \
&& apt-get purge -y --auto-remove $buildDeps \
&& pecl install \
apcu-$APCU_VERSION \
&& docker-php-ext-enable --ini-name 05-opcache.ini \
opcache \
&& docker-php-ext-enable --ini-name 20-apcu.ini \
apcu
# Apache config
RUN a2enmod rewrite headers
ADD docker/web/vhost.conf /etc/apache2/sites-available/000-default.conf
ADD docker/web/php.ini /usr/local/etc/php/php.ini
ADD docker/web/composer.sh /usr/bin/composer.sh
# Add the application
ADD . /app
WORKDIR /app
# Install composer
RUN ./docker/web/composer.sh \
&& mv composer.phar /usr/bin/composer \
&& composer global require "hirak/prestissimo:^0.3"
RUN \
# Remove var directory if it's accidentally included
(rm -rf var || true) \
# Create the var sub-directories
&& mkdir -p var/cache var/logs var/sessions \
# Install dependencies
&& composer install --optimize-autoloader --no-scripts \
# Fixes permissions issues in non-dev mode
&& chown -R www-data . var/cache var/logs var/sessions
CMD ["/app/docker/web/start.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment