mirror of
https://github.com/danog/php.git
synced 2024-11-27 04:14:56 +01:00
a6e6a6381d
This results in a dramatic reduction of image size: ```console $ docker images php REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE php 5.4 6b03f428509e 3 hours ago 354.3 MB php 5.4-apache 2bd126f2c469 2 minutes ago 394.8 MB php 5.5 19a5113df69a 9 minutes ago 356.4 MB php 5.5-apache 6c892721307f 2 minutes ago 396.9 MB php 5.6 69aead156fe7 10 minutes ago 356.8 MB php 5.6-apache 2d0bae628aaf About an hour ago 397.3 MB ``` vs the old: ```console $ docker images php REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE php 5.4 e760b9bd2c6c 2 days ago 736.9 MB php 5.4-apache 62c23e8f1704 2 days ago 811.8 MB php 5.5 156d2a323bc0 2 days ago 739.8 MB php 5.5-apache 3014d0f81b29 2 days ago 814.7 MB php 5.6 dab86418397c 2 days ago 740.2 MB php 5.6-apache b3c4a0633954 2 days ago 815.1 MB ```
14 lines
757 B
Plaintext
14 lines
757 B
Plaintext
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
|
|
|
|
# Apache + PHP requires preforking Apache for best results
|
|
RUN a2dismod mpm_event && a2enmod mpm_prefork
|
|
|
|
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
|
|
COPY apache2.conf /etc/apache2/apache2.conf
|
|
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
|
|
|
|
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
|
|
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
|