Simplify "-apache" images by using the Debian apache2 packages

This commit is contained in:
Tianon Gravi 2014-09-15 11:31:14 -06:00
parent 21df8a5f42
commit 7819c242fd
16 changed files with 438 additions and 222 deletions

View File

@ -1,4 +1,9 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7
@ -6,7 +11,7 @@ ENV PHP_VERSION 5.3.29
# php 5.3 needs older autoconf
RUN set -x \
&& apt-get update && apt-get install -y autoconf2.13 curl && rm -r /var/lib/apt/lists/* \
&& apt-get update && apt-get install -y autoconf2.13 && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -16,15 +21,19 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove autoconf2.13 curl \
&& apt-get purge -y --auto-remove autoconf2.13 \
&& rm -r /usr/src/php
CMD ["php", "-a"]

View File

@ -1,4 +1,18 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
RUN apt-get update && apt-get install -y apache2-bin apache2-dev 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
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7
@ -6,7 +20,7 @@ ENV PHP_VERSION 5.3.29
# php 5.3 needs older autoconf
RUN set -x \
&& apt-get update && apt-get install -y autoconf2.13 curl && rm -r /var/lib/apt/lists/* \
&& apt-get update && apt-get install -y autoconf2.13 && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -16,54 +30,23 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
\
&& cd / \
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
&& gpg --verify httpd.tar.bz2.asc \
&& mkdir -p /usr/src/httpd \
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
&& rm httpd.tar.bz2.* \
&& cd /usr/src/httpd \
&& ./configure --enable-so \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -r /usr/src/httpd \
&& mkdir -p /var/www/html \
&& sed -r ' \
s/(DirectoryIndex index[.])html/\1php/; \
s!/usr/local/apache2/htdocs!/var/www/html!g; \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
&& rm /usr/local/apache2/conf/httpd.conf \
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
&& cd /usr/src/php \
&& make clean \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& cp php.ini-development /usr/local/lib/php.ini \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove autoconf2.13 curl \
&& apt-get purge -y --auto-remove autoconf2.13 \
&& rm -r /usr/src/php
ENV PATH $PATH:/usr/local/apache2/bin
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["httpd", "-DFOREGROUND"]
CMD ["apache2", "-DFOREGROUND"]

57
5.3/apache/apache2.conf Normal file
View File

@ -0,0 +1,57 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
DocumentRoot /var/www/html

View File

@ -1,11 +1,15 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
ENV PHP_VERSION 5.4.32
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,15 +19,18 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
CMD ["php", "-a"]

View File

@ -1,11 +1,24 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
RUN apt-get update && apt-get install -y apache2-bin apache2-dev 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
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
ENV PHP_VERSION 5.4.32
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,54 +28,22 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
\
&& cd / \
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
&& gpg --verify httpd.tar.bz2.asc \
&& mkdir -p /usr/src/httpd \
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
&& rm httpd.tar.bz2.* \
&& cd /usr/src/httpd \
&& ./configure --enable-so \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -r /usr/src/httpd \
&& mkdir -p /var/www/html \
&& sed -r ' \
s/(DirectoryIndex index[.])html/\1php/; \
s!/usr/local/apache2/htdocs!/var/www/html!g; \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
&& rm /usr/local/apache2/conf/httpd.conf \
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
&& cd /usr/src/php \
&& make clean \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& cp php.ini-development /usr/local/lib/php.ini \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
ENV PATH $PATH:/usr/local/apache2/bin
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["httpd", "-DFOREGROUND"]
CMD ["apache2", "-DFOREGROUND"]

57
5.4/apache/apache2.conf Normal file
View File

@ -0,0 +1,57 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
DocumentRoot /var/www/html

View File

@ -1,11 +1,15 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
ENV PHP_VERSION 5.5.16
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,15 +19,18 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
CMD ["php", "-a"]

View File

@ -1,11 +1,24 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
RUN apt-get update && apt-get install -y apache2-bin apache2-dev 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
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
ENV PHP_VERSION 5.5.16
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,54 +28,22 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
\
&& cd / \
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
&& gpg --verify httpd.tar.bz2.asc \
&& mkdir -p /usr/src/httpd \
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
&& rm httpd.tar.bz2.* \
&& cd /usr/src/httpd \
&& ./configure --enable-so \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -r /usr/src/httpd \
&& mkdir -p /var/www/html \
&& sed -r ' \
s/(DirectoryIndex index[.])html/\1php/; \
s!/usr/local/apache2/htdocs!/var/www/html!g; \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
&& rm /usr/local/apache2/conf/httpd.conf \
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
&& cd /usr/src/php \
&& make clean \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& cp php.ini-development /usr/local/lib/php.ini \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
ENV PATH $PATH:/usr/local/apache2/bin
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["httpd", "-DFOREGROUND"]
CMD ["apache2", "-DFOREGROUND"]

57
5.5/apache/apache2.conf Normal file
View File

@ -0,0 +1,57 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
DocumentRoot /var/www/html

View File

@ -1,11 +1,15 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1
ENV PHP_VERSION 5.6.0
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,15 +19,18 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
CMD ["php", "-a"]

View File

@ -1,11 +1,24 @@
FROM buildpack-deps
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
##<apache2>##
RUN apt-get update && apt-get install -y apache2-bin apache2-dev 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
##</apache2>##
RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1
ENV PHP_VERSION 5.6.0
RUN set -x \
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
@ -15,54 +28,22 @@ RUN set -x \
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
&& gpg --verify php.tar.bz2.asc \
&& mkdir -p /usr/src/php \
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \
&& rm php.tar.bz2* \
&& cd /usr/src/php \
&& ./buildconf --force \
&& ./configure --disable-cgi \
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
\
&& cd / \
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
&& gpg --verify httpd.tar.bz2.asc \
&& mkdir -p /usr/src/httpd \
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
&& rm httpd.tar.bz2.* \
&& cd /usr/src/httpd \
&& ./configure --enable-so \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -r /usr/src/httpd \
&& mkdir -p /var/www/html \
&& sed -r ' \
s/(DirectoryIndex index[.])html/\1php/; \
s!/usr/local/apache2/htdocs!/var/www/html!g; \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
&& rm /usr/local/apache2/conf/httpd.conf \
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
&& cd /usr/src/php \
&& make clean \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& cp php.ini-development /usr/local/lib/php.ini \
&& dpkg -r bison libbison-dev \
&& apt-get purge -y --auto-remove curl \
&& rm -r /usr/src/php
ENV PATH $PATH:/usr/local/apache2/bin
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["httpd", "-DFOREGROUND"]
CMD ["apache2", "-DFOREGROUND"]

57
5.6/apache/apache2.conf Normal file
View File

@ -0,0 +1,57 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
DocumentRoot /var/www/html

View File

@ -1,34 +0,0 @@
&& make install \
\
&& cd / \
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
&& gpg --verify httpd.tar.bz2.asc \
&& mkdir -p /usr/src/httpd \
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
&& rm httpd.tar.bz2.* \
&& cd /usr/src/httpd \
&& ./configure --enable-so \
&& make -j"$(nproc)" \
&& make install \
&& cd / \
&& rm -r /usr/src/httpd \
&& mkdir -p /var/www/html \
&& sed -r ' \
s/(DirectoryIndex index[.])html/\1php/; \
s!/usr/local/apache2/htdocs!/var/www/html!g; \
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
&& rm /usr/local/apache2/conf/httpd.conf \
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
&& cd /usr/src/php \
&& make clean \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-mysqli --with-pdo-mysql \
&& make -j"$(nproc)" \
&& make install \
&& cp php.ini-development /usr/local/lib/php.ini \

View File

@ -1,7 +0,0 @@
ENV PATH $PATH:/usr/local/apache2/bin
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["httpd", "-DFOREGROUND"]

57
apache2.conf Normal file
View File

@ -0,0 +1,57 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
DirectoryIndex index.php
DocumentRoot /var/www/html

View File

@ -31,9 +31,26 @@ for version in "${versions[@]}"; do
exit 1
fi
dockerfile="$( cat "$version/Dockerfile")"
apacheInsert="$(cat "Dockerfile-apache-insert")"
apacheTail="$(cat "Dockerfile-apache-tail")"
awk '$1 != "CMD" { print } $1 == "##<apache2>##" && c == 0 { c = 1; system("cat") }' "$version/Dockerfile" > "$version/apache/Dockerfile" <<-'EOD'
RUN apt-get update && apt-get install -y apache2-bin apache2-dev 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
EOD
cat >> "$version/apache/Dockerfile" <<-'EOD'
WORKDIR /var/www/html
VOLUME /var/www/html
EXPOSE 80
CMD ["apache2", "-DFOREGROUND"]
EOD
(
set -x
sed -ri '
@ -41,8 +58,7 @@ for version in "${versions[@]}"; do
s/^(RUN gpg .* --recv-keys) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/
' "$version/Dockerfile"
apacheDockerfile="${dockerfile/?\&\& make install \\/$apacheInsert}"
echo "${apacheDockerfile/CMD*/$apacheTail}" > "$version/apache/Dockerfile"
cp apache2.conf "$version/apache/"
)
done