Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from hakkens/docker
Docker all the things!
- Loading branch information
Showing
610 changed files
with
343 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,65 @@ | ||
FROM php:5.6-apache | ||
|
||
RUN a2enmod rewrite | ||
FROM php:7.2-apache | ||
|
||
# install the PHP extensions we need | ||
RUN apt-get update && apt-get install -y libmcrypt-dev libpng12-dev libjpeg-dev && rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-install -j$(nproc) mcrypt \ | ||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ | ||
&& docker-php-ext-install gd | ||
RUN docker-php-ext-install mysqli | ||
RUN set -ex; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
\ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
libjpeg-dev \ | ||
libpng-dev \ | ||
libmcrypt-dev \ | ||
; \ | ||
\ | ||
pecl install mcrypt-1.0.1; \ | ||
docker-php-ext-enable mcrypt; \ | ||
docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ | ||
docker-php-ext-install gd mysqli opcache zip; \ | ||
\ | ||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies | ||
apt-mark auto '.*' > /dev/null; \ | ||
apt-mark manual $savedAptMark; \ | ||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | ||
| awk '/=>/ { print $3 }' \ | ||
| sort -u \ | ||
| xargs -r dpkg-query -S \ | ||
| cut -d: -f1 \ | ||
| sort -u \ | ||
| xargs -rt apt-mark manual; \ | ||
\ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# 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 | ||
|
||
RUN a2enmod rewrite expires | ||
|
||
VOLUME /var/www/html | ||
|
||
ENV WORDPRESS_VERSION 4.8 | ||
ENV WORDPRESS_UPSTREAM_VERSION 4.8 | ||
ENV WORDPRESS_SHA1 3738189a1f37a03fb9cb087160b457d7a641ccb4 | ||
ENV WORDPRESS_VERSION 4.9.6 | ||
ENV WORDPRESS_SHA1 40616b40d120c97205e5852c03096115c2fca537 | ||
|
||
RUN set -ex; \ | ||
curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz"; \ | ||
echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c -; \ | ||
# upstream tarballs include ./wordpress/ so this gives us /usr/src/wordpress | ||
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_UPSTREAM_VERSION}.tar.gz \ | ||
&& echo "$WORDPRESS_SHA1 *wordpress.tar.gz" | sha1sum -c - \ | ||
&& tar -xzf wordpress.tar.gz -C /usr/src/ \ | ||
&& rm wordpress.tar.gz \ | ||
&& chown -R www-data:www-data /usr/src/wordpress | ||
tar -xzf wordpress.tar.gz -C /usr/src/; \ | ||
rm wordpress.tar.gz; \ | ||
chown -R www-data:www-data /usr/src/wordpress | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
|
||
# grr, ENTRYPOINT resets CMD now | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
CMD ["chown www-data:www-data -R /var/www/html/wp-content/themes"] | ||
CMD ["a2enmod rewrite"] | ||
CMD ["apache2-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.