mirror of
https://github.com/danog/php.git
synced 2024-11-26 20:04:58 +01:00
Add update.sh, add partial files for generating the apache Dockerfile
This commit is contained in:
parent
c60948d08b
commit
f9483c93a9
34
Dockerfile-apache-insert
Normal file
34
Dockerfile-apache-insert
Normal file
@ -0,0 +1,34 @@
|
||||
&& 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 \
|
||||
&& make -j"$(nproc)" \
|
||||
&& make install \
|
||||
&& cp php.ini-development /usr/local/lib/php.ini \
|
8
Dockerfile-apache-tail
Normal file
8
Dockerfile-apache-tail
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
ENV PATH $PATH:/usr/local/apache2/bin
|
||||
|
||||
WORKDIR /var/www/html
|
||||
VOLUME /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["apachectl", "start", "-DFOREGROUND"]
|
43
update.sh
Executable file
43
update.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
declare -A gpgKeys
|
||||
gpgKeys=(
|
||||
[5.5]='0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D'
|
||||
)
|
||||
# see http://php.net/downloads.php
|
||||
|
||||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
||||
|
||||
versions=( "$@" )
|
||||
if [ ${#versions[@]} -eq 0 ]; then
|
||||
versions=( */ )
|
||||
fi
|
||||
versions=( "${versions[@]%/}" )
|
||||
|
||||
packagesUrl='http://php.net/releases/index.php?serialize=1&version=5'
|
||||
packages="$(echo "$packagesUrl" | sed -r 's/[^a-zA-Z.-]+/-/g')"
|
||||
curl -sSL "${packagesUrl}.gz" > "$packages"
|
||||
|
||||
for version in "${versions[@]}"; do
|
||||
fullVersion="$(sed -r 's/.*"filename";s:[0-9]+:"php-([^"]+)\.tar\.bz2".*/\1/' $packages)"
|
||||
gpgKey="${gpgKeys[$version]}"
|
||||
if [ -z "$gpgKey" ]; then
|
||||
echo >&2 "ERROR: missing GPG key fingerprint for $version; try:"
|
||||
echo >&2 " try looking on http://php.net/downloads.php#gpg-$version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
insert="$(cat "Dockerfile-apache-insert" | sed 's/[\]/\\&/g')"
|
||||
(
|
||||
set -x
|
||||
sed -ri '
|
||||
s/^(ENV PHP_VERSION) .*/\1 '"$fullVersion"'/;
|
||||
s/^(RUN gpg .* --recv-keys) [0-9a-fA-F]*$/\1 '"$gpgKey"'/
|
||||
' "$version/Dockerfile"
|
||||
|
||||
awk -vf2="$insert" '/^\t&& make install \\$/{print f2;next}1' "$version/Dockerfile" "Dockerfile-apache-tail" > "$version/apache/Dockerfile"
|
||||
)
|
||||
done
|
||||
|
||||
rm "$packages"
|
Loading…
Reference in New Issue
Block a user