diff --git a/5.3/Dockerfile b/5.3/Dockerfile index 501c37e209..9eee7c4b07 100644 --- a/5.3/Dockerfile +++ b/5.3/Dockerfile @@ -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/* + +#### +#### 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"] diff --git a/5.3/apache/Dockerfile b/5.3/apache/Dockerfile index 257a88bedf..8c3120ce18 100644 --- a/5.3/apache/Dockerfile +++ b/5.3/apache/Dockerfile @@ -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/* + +#### +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 +#### 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\n\tSetHandler application/x-httpd-php\n \ - ' /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 "Hello, World!'; ?>" >> /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"] diff --git a/5.3/apache/apache2.conf b/5.3/apache/apache2.conf new file mode 100644 index 0000000000..85ef37884d --- /dev/null +++ b/5.3/apache/apache2.conf @@ -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 + + Listen 443 + + + Listen 443 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + Require all denied + + +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 + + + SetHandler application/x-httpd-php + +DirectoryIndex index.php + +DocumentRoot /var/www/html diff --git a/5.4/Dockerfile b/5.4/Dockerfile index b7ac93fa15..b41e9283f9 100644 --- a/5.4/Dockerfile +++ b/5.4/Dockerfile @@ -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/* + +#### +#### 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"] diff --git a/5.4/apache/Dockerfile b/5.4/apache/Dockerfile index c9058b8449..8631082bd2 100644 --- a/5.4/apache/Dockerfile +++ b/5.4/apache/Dockerfile @@ -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/* + +#### +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 +#### 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\n\tSetHandler application/x-httpd-php\n \ - ' /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 "Hello, World!'; ?>" >> /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"] diff --git a/5.4/apache/apache2.conf b/5.4/apache/apache2.conf new file mode 100644 index 0000000000..85ef37884d --- /dev/null +++ b/5.4/apache/apache2.conf @@ -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 + + Listen 443 + + + Listen 443 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + Require all denied + + +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 + + + SetHandler application/x-httpd-php + +DirectoryIndex index.php + +DocumentRoot /var/www/html diff --git a/5.5/Dockerfile b/5.5/Dockerfile index 926fb5b224..f5ae2c2e5a 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -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/* + +#### +#### 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"] diff --git a/5.5/apache/Dockerfile b/5.5/apache/Dockerfile index c1f264eacf..0501a930f5 100644 --- a/5.5/apache/Dockerfile +++ b/5.5/apache/Dockerfile @@ -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/* + +#### +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 +#### 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\n\tSetHandler application/x-httpd-php\n \ - ' /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 "Hello, World!'; ?>" >> /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"] diff --git a/5.5/apache/apache2.conf b/5.5/apache/apache2.conf new file mode 100644 index 0000000000..85ef37884d --- /dev/null +++ b/5.5/apache/apache2.conf @@ -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 + + Listen 443 + + + Listen 443 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + Require all denied + + +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 + + + SetHandler application/x-httpd-php + +DirectoryIndex index.php + +DocumentRoot /var/www/html diff --git a/5.6/Dockerfile b/5.6/Dockerfile index d95137aca9..7b030d6453 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -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/* + +#### +#### 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"] diff --git a/5.6/apache/Dockerfile b/5.6/apache/Dockerfile index e06c4d828c..67b5263d8d 100644 --- a/5.6/apache/Dockerfile +++ b/5.6/apache/Dockerfile @@ -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/* + +#### +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 +#### 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\n\tSetHandler application/x-httpd-php\n \ - ' /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 "Hello, World!'; ?>" >> /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"] diff --git a/5.6/apache/apache2.conf b/5.6/apache/apache2.conf new file mode 100644 index 0000000000..85ef37884d --- /dev/null +++ b/5.6/apache/apache2.conf @@ -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 + + Listen 443 + + + Listen 443 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + Require all denied + + +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 + + + SetHandler application/x-httpd-php + +DirectoryIndex index.php + +DocumentRoot /var/www/html diff --git a/Dockerfile-apache-insert b/Dockerfile-apache-insert deleted file mode 100644 index e40865aea0..0000000000 --- a/Dockerfile-apache-insert +++ /dev/null @@ -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\n\tSetHandler application/x-httpd-php\n \ - ' /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 "Hello, World!'; ?>" >> /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 \ diff --git a/Dockerfile-apache-tail b/Dockerfile-apache-tail deleted file mode 100644 index 4c49c88716..0000000000 --- a/Dockerfile-apache-tail +++ /dev/null @@ -1,7 +0,0 @@ -ENV PATH $PATH:/usr/local/apache2/bin - -WORKDIR /var/www/html -VOLUME /var/www/html - -EXPOSE 80 -CMD ["httpd", "-DFOREGROUND"] diff --git a/apache2.conf b/apache2.conf new file mode 100644 index 0000000000..85ef37884d --- /dev/null +++ b/apache2.conf @@ -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 + + Listen 443 + + + Listen 443 + + + + Options FollowSymLinks + AllowOverride None + Require all denied + + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +AccessFileName .htaccess + + Require all denied + + +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 + + + SetHandler application/x-httpd-php + +DirectoryIndex index.php + +DocumentRoot /var/www/html diff --git a/update.sh b/update.sh index 937a830705..8bcf98b69f 100755 --- a/update.sh +++ b/update.sh @@ -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 == "####" && 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