Skip to content

Commit f9483c9

Browse files
committed
Add update.sh, add partial files for generating the apache Dockerfile
1 parent c60948d commit f9483c9

File tree

5 files changed

+85
-0
lines changed

5 files changed

+85
-0
lines changed
File renamed without changes.
File renamed without changes.

Dockerfile-apache-insert

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
&& make install \
2+
\
3+
&& cd / \
4+
&& gpg --keyserver pgp.mit.edu --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
5+
&& apt-get update && apt-get install -y libapr1-dev libaprutil1-dev && rm -r /var/lib/apt/lists/* \
6+
&& curl -SL "http://apache.osuosl.org/httpd/httpd-2.4.10.tar.bz2" -o httpd.tar.bz2 \
7+
&& curl -SL "https://www.apache.org/dist/httpd/httpd-2.4.10.tar.bz2.asc" -o httpd.tar.bz2.asc \
8+
&& gpg --verify httpd.tar.bz2.asc \
9+
&& mkdir -p /usr/src/httpd \
10+
&& tar -xvf httpd.tar.bz2 -C /usr/src/httpd --strip-components=1 \
11+
&& rm httpd.tar.bz2.* \
12+
&& cd /usr/src/httpd \
13+
&& ./configure --enable-so \
14+
&& make -j"$(nproc)" \
15+
&& make install \
16+
&& cd / \
17+
&& rm -r /usr/src/httpd \
18+
&& mkdir -p /var/www/html \
19+
&& sed -r ' \
20+
s/(DirectoryIndex index[.])html/\1php/; \
21+
s!/usr/local/apache2/htdocs!/var/www/html!g; \
22+
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \
23+
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \
24+
$ a<FilesMatch \\.php$>\n\tSetHandler application/x-httpd-php\n</FilesMatch> \
25+
' /usr/local/apache2/conf/httpd.conf > /etc/apache2/httpd.conf \
26+
&& rm /usr/local/apache2/conf/httpd.conf \
27+
&& ln -s /etc/apache2/httpd.conf /usr/local/apache2/conf/httpd.conf \
28+
&& echo "<html><head></head><body><?php echo '<h1>Hello, World!</h1>'; ?></body></html>" >> /var/www/html/index.php \
29+
&& cd /usr/src/php \
30+
&& make clean \
31+
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql \
32+
&& make -j"$(nproc)" \
33+
&& make install \
34+
&& cp php.ini-development /usr/local/lib/php.ini \

Dockerfile-apache-tail

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
ENV PATH $PATH:/usr/local/apache2/bin
3+
4+
WORKDIR /var/www/html
5+
VOLUME /var/www/html
6+
7+
EXPOSE 80
8+
CMD ["apachectl", "start", "-DFOREGROUND"]

update.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
set -e
3+
4+
declare -A gpgKeys
5+
gpgKeys=(
6+
[5.5]='0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D'
7+
)
8+
# see http://php.net/downloads.php
9+
10+
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
11+
12+
versions=( "$@" )
13+
if [ ${#versions[@]} -eq 0 ]; then
14+
versions=( */ )
15+
fi
16+
versions=( "${versions[@]%/}" )
17+
18+
packagesUrl='http://php.net/releases/index.php?serialize=1&version=5'
19+
packages="$(echo "$packagesUrl" | sed -r 's/[^a-zA-Z.-]+/-/g')"
20+
curl -sSL "${packagesUrl}.gz" > "$packages"
21+
22+
for version in "${versions[@]}"; do
23+
fullVersion="$(sed -r 's/.*"filename";s:[0-9]+:"php-([^"]+)\.tar\.bz2".*/\1/' $packages)"
24+
gpgKey="${gpgKeys[$version]}"
25+
if [ -z "$gpgKey" ]; then
26+
echo >&2 "ERROR: missing GPG key fingerprint for $version; try:"
27+
echo >&2 " try looking on http://php.net/downloads.php#gpg-$version"
28+
exit 1
29+
fi
30+
31+
insert="$(cat "Dockerfile-apache-insert" | sed 's/[\]/\\&/g')"
32+
(
33+
set -x
34+
sed -ri '
35+
s/^(ENV PHP_VERSION) .*/\1 '"$fullVersion"'/;
36+
s/^(RUN gpg .* --recv-keys) [0-9a-fA-F]*$/\1 '"$gpgKey"'/
37+
' "$version/Dockerfile"
38+
39+
awk -vf2="$insert" '/^\t&& make install \\$/{print f2;next}1' "$version/Dockerfile" "Dockerfile-apache-tail" > "$version/apache/Dockerfile"
40+
)
41+
done
42+
43+
rm "$packages"

0 commit comments

Comments
 (0)