Last active
May 13, 2016 11:56
-
-
Save kuronekomichael/c14c99475ea73285210d6ed1d8929cd6 to your computer and use it in GitHub Desktop.
Dockerfile for Apache 2.2.15 / based on https://github.com/docker-library/httpd/tree/master/2.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gpmidi/centos-6.2 | |
#FROM debian:jessie | |
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added | |
#RUN groupadd -r www-data && useradd -r --create-home -g www-data www-data | |
ENV HTTPD_PREFIX /usr/local/apache2 | |
ENV PATH $PATH:$HTTPD_PREFIX/bin | |
RUN mkdir -p "$HTTPD_PREFIX" \ | |
&& chown www-data:www-data "$HTTPD_PREFIX" | |
WORKDIR $HTTPD_PREFIX | |
# install httpd runtime dependencies | |
# https://httpd.apache.org/docs/2.4/install.html#requirements | |
RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
libapr1 \ | |
libaprutil1 \ | |
libapr1-dev \ | |
libaprutil1-dev \ | |
libpcre++0 \ | |
libssl1.0.0 \ | |
&& rm -r /var/lib/apt/lists/* | |
ENV HTTPD_VERSION 2.2.15 | |
ENV HTTPD_BZ2_URL https://archive.apache.org/dist/httpd/httpd-$HTTPD_VERSION.tar.bz2 | |
RUN buildDeps=' \ | |
ca-certificates \ | |
curl \ | |
bzip2 \ | |
gcc \ | |
libpcre++-dev \ | |
libssl-dev \ | |
make \ | |
' \ | |
set -x \ | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends $buildDeps \ | |
&& rm -r /var/lib/apt/lists/* \ | |
&& curl -fSL "$HTTPD_BZ2_URL" -o httpd.tar.bz2 \ | |
&& curl -fSL "$HTTPD_BZ2_URL.asc" -o httpd.tar.bz2.asc \ | |
# see https://httpd.apache.org/download.cgi#verify | |
&& export GNUPGHOME="$(mktemp -d)" \ | |
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B1B96F45DFBDCCF974019235193F180AB55D9977 \ | |
&& gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2 \ | |
&& rm -r "$GNUPGHOME" httpd.tar.bz2.asc \ | |
&& mkdir -p src/httpd \ | |
&& tar -xvf httpd.tar.bz2 -C src/httpd --strip-components=1 \ | |
&& rm httpd.tar.bz2 \ | |
&& cd src/httpd \ | |
&& ./configure --enable-so --enable-ssl --prefix=$HTTPD_PREFIX --enable-mods-shared=most \ | |
&& make -j"$(nproc)" \ | |
&& make install \ | |
&& cd ../../ \ | |
&& rm -r src/httpd \ | |
&& sed -ri ' \ | |
s!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g; \ | |
s!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g; \ | |
' /usr/local/apache2/conf/httpd.conf \ | |
&& apt-get purge -y --auto-remove $buildDeps | |
COPY httpd-foreground /usr/local/bin/ | |
EXPOSE 80 | |
CMD ["httpd-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Apache gets grumpy about PID files pre-existing | |
rm -f /usr/local/apache2/logs/httpd.pid | |
exec httpd -DFOREGROUND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment