Skip to content

Commit c60948d

Browse files
committed
Dockerfiles to pull php and apache from source tars
0 parents  commit c60948d

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM buildpack-deps
2+
3+
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
4+
5+
ENV PHP_VERSION 5.5.15
6+
7+
RUN set -x \
8+
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
9+
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
10+
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
11+
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
12+
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
13+
&& rm *.deb \
14+
&& curl -SL "http://us2.php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
15+
&& curl -SL "http://us2.php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
16+
&& gpg --verify php.tar.bz2.asc \
17+
&& mkdir -p /usr/src/php \
18+
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
19+
&& rm php.tar.bz2* \
20+
&& cd /usr/src/php \
21+
&& ./buildconf --force \
22+
&& ./configure --disable-cgi \
23+
&& make -j"$(nproc)" \
24+
&& make install \
25+
&& apt-get purge -y curl \
26+
&& apt-get autoremove -y \
27+
&& rm -r /usr/src/php

docker-apache/Dockerfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM buildpack-deps
2+
3+
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
4+
5+
ENV PHP_VERSION 5.5.15
6+
7+
RUN set -x \
8+
&& apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/* \
9+
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
10+
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
11+
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
12+
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
13+
&& rm *.deb \
14+
&& curl -SL "http://us2.php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
15+
&& curl -SL "http://us2.php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
16+
&& gpg --verify php.tar.bz2.asc \
17+
&& mkdir -p /usr/src/php \
18+
&& tar -xvf php.tar.bz2 -C /usr/src/php --strip-components=1 \
19+
&& rm php.tar.bz2* \
20+
&& cd /usr/src/php \
21+
&& ./buildconf --force \
22+
&& ./configure --disable-cgi \
23+
&& make -j"$(nproc)" \
24+
&& make install \
25+
\
26+
&& cd / \
27+
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
28+
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
29+
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
30+
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
31+
&& gpg --verify httpd.tar.bz2.asc \
32+
&& mkdir -p /usr/src/httpd \
33+
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
34+
&& rm httpd.tar.bz2.* \
35+
&& cd /usr/src/httpd \
36+
&& ./configure --enable-so \
37+
&& make -j"$(nproc)" \
38+
&& make install \
39+
&& cd / \
40+
&& rm -r /usr/src/httpd \
41+
&& mkdir -p /var/www/html \
42+
&& sed -r ' \
43+
s/(DirectoryIndex index[.])html/\1php/; \
44+
s!/usr/local/apache2/htdocs!/var/www/html!g; \
45+
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
46+
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
47+
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
48+
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
49+
&& rm /usr/local/apache2/conf/httpd.conf \
50+
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
51+
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
52+
&& cd /usr/src/php \
53+
&& make clean \
54+
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql \
55+
&& make -j"$(nproc)" \
56+
&& make install \
57+
&& cp php.ini-development /usr/local/lib/php.ini \
58+
&& apt-get purge -y curl \
59+
&& apt-get autoremove -y \
60+
&& rm -r /usr/src/php
61+
62+
ENV PATH $PATH:/usr/local/apache2/bin
63+
64+
WORKDIR /var/www/html
65+
VOLUME /var/www/html
66+
67+
EXPOSE 80
68+
CMD ["apachectl", "start", "-DFOREGROUND"]

0 commit comments

Comments
 (0)