Skip to content

Commit a1cd25a

Browse files
committed
First clean build, not tested
1 parent 9496bb6 commit a1cd25a

File tree

1 file changed

+145
-122
lines changed

1 file changed

+145
-122
lines changed

Dockerfile

Lines changed: 145 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,178 @@
11
FROM debian:jessie-backports
2+
LABEL name="httpd-svn" \
3+
description="Apache httpd with Subversion" \
4+
maintainer="erik.wramner@codemint.com"
25

36
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
47
#RUN groupadd -r www-data && useradd -r --create-home -g www-data www-data
58

9+
ENV HTTPD_VERSION 2.4.34
10+
ENV HTTPD_SHA256 fa53c95631febb08a9de41fd2864cfff815cf62d9306723ab0d4b8d7aa1638f0
11+
ENV SVN_VERSION 1.10.2
12+
ENV SVN_SHA512 ccbe860ec93a198745e40620cb7e005a85797e344a99ddbc0e24c32ad846976eae35cf5b3d62ba5751b998f0d40bbebbba72f484d92c92693bbb2112c989b129
13+
ENV NGHTTP2_VERSION 1.18.1-1
14+
ENV OPENSSL_VERSION 1.0.2l-1~bpo8+1
15+
616
ENV HTTPD_PREFIX /usr/local/apache2
717
ENV PATH $HTTPD_PREFIX/bin:$PATH
18+
19+
COPY httpd-foreground /usr/local/bin/
820
RUN mkdir -p "$HTTPD_PREFIX" \
9-
&& chown www-data:www-data "$HTTPD_PREFIX"
21+
&& chown www-data:www-data "$HTTPD_PREFIX"
1022
WORKDIR $HTTPD_PREFIX
1123

12-
# library for mod_http2
13-
ENV NGHTTP2_VERSION 1.18.1-1
14-
ENV OPENSSL_VERSION 1.0.2l-1~bpo8+1
1524
RUN { \
16-
echo 'deb http://deb.debian.org/debian stretch main'; \
17-
} > /etc/apt/sources.list.d/stretch.list \
18-
&& { \
25+
echo 'deb http://deb.debian.org/debian stretch main'; \
26+
} > /etc/apt/sources.list.d/stretch.list \
27+
&& { \
1928
# add a negative "Pin-Priority" so that we never ever get packages from stretch unless we explicitly request them
20-
echo 'Package: *'; \
21-
echo 'Pin: release n=stretch'; \
22-
echo 'Pin-Priority: -10'; \
23-
echo; \
29+
echo 'Package: *'; \
30+
echo 'Pin: release n=stretch'; \
31+
echo 'Pin-Priority: -10'; \
32+
echo; \
2433
# except nghttp2, which is the reason we're here
25-
echo 'Package: libnghttp2*'; \
26-
echo "Pin: version $NGHTTP2_VERSION"; \
27-
echo 'Pin-Priority: 990'; \
28-
echo; \
29-
} > /etc/apt/preferences.d/unstable-nghttp2
34+
echo 'Package: libnghttp2*'; \
35+
echo "Pin: version $NGHTTP2_VERSION"; \
36+
echo 'Pin-Priority: 990'; \
37+
echo; \
38+
} > /etc/apt/preferences.d/unstable-nghttp2
3039

3140
# install httpd runtime dependencies
3241
# https://httpd.apache.org/docs/2.4/install.html#requirements
3342
RUN apt-get update \
34-
&& apt-get install -y --no-install-recommends \
35-
libapr1 \
36-
libaprutil1 \
37-
libaprutil1-ldap \
38-
libapr1-dev \
39-
libaprutil1-dev \
40-
liblua5.2-0 \
41-
libnghttp2-14=$NGHTTP2_VERSION \
42-
libpcre++0 \
43-
libssl1.0.0=$OPENSSL_VERSION \
44-
libxml2 \
45-
&& rm -r /var/lib/apt/lists/*
46-
47-
ENV HTTPD_VERSION 2.4.34
48-
ENV HTTPD_SHA256 fa53c95631febb08a9de41fd2864cfff815cf62d9306723ab0d4b8d7aa1638f0
43+
&& apt-get install -y --no-install-recommends \
44+
libapr1 \
45+
libaprutil1 \
46+
libaprutil1-ldap \
47+
libapr1-dev \
48+
libaprutil1-dev \
49+
liblua5.2-0 \
50+
libnghttp2-14=$NGHTTP2_VERSION \
51+
libpcre++0 \
52+
libssl1.0.0=$OPENSSL_VERSION \
53+
libxml2 \
54+
&& rm -r /var/lib/apt/lists/*
4955

5056
# https://httpd.apache.org/security/vulnerabilities_24.html
5157
ENV HTTPD_PATCHES=""
5258

5359
ENV APACHE_DIST_URLS \
5460
# https://issues.apache.org/jira/browse/INFRA-8753?focusedCommentId=14735394#comment-14735394
55-
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
61+
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
5662
# if the version is outdated (or we're grabbing the .asc file), we might have to pull from the dist/archive :/
57-
https://www-us.apache.org/dist/ \
58-
https://www.apache.org/dist/ \
59-
https://archive.apache.org/dist/
63+
https://www-us.apache.org/dist/ \
64+
https://www.apache.org/dist/ \
65+
https://archive.apache.org/dist/
6066

6167
# see https://httpd.apache.org/docs/2.4/install.html#requirements
68+
# plus libsqlite3-dev for svn
6269
RUN set -eux; \
63-
\
64-
# mod_http2 mod_lua mod_proxy_html mod_xml2enc
65-
# https://anonscm.debian.org/cgit/pkg-apache/apache2.git/tree/debian/control?id=adb6f181257af28ee67af15fc49d2699a0080d4c
66-
buildDeps=" \
67-
bzip2 \
68-
ca-certificates \
69-
dpkg-dev \
70-
gcc \
71-
liblua5.2-dev \
72-
libnghttp2-dev=$NGHTTP2_VERSION \
73-
libpcre++-dev \
74-
libssl-dev=$OPENSSL_VERSION \
75-
libxml2-dev \
76-
zlib1g-dev \
77-
make \
78-
wget \
79-
"; \
80-
apt-get update; \
81-
apt-get install -y --no-install-recommends -V $buildDeps; \
82-
rm -r /var/lib/apt/lists/*; \
83-
\
84-
ddist() { \
85-
local f="$1"; shift; \
86-
local distFile="$1"; shift; \
87-
local success=; \
88-
local distUrl=; \
89-
for distUrl in $APACHE_DIST_URLS; do \
90-
if wget -O "$f" "$distUrl$distFile" && [ -s "$f" ]; then \
91-
success=1; \
92-
break; \
93-
fi; \
94-
done; \
95-
[ -n "$success" ]; \
96-
}; \
97-
\
98-
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
99-
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
100-
\
70+
\
71+
# mod_http2 mod_lua mod_proxy_html mod_xml2enc
72+
# https://anonscm.debian.org/cgit/pkg-apache/apache2.git/tree/debian/control?id=adb6f181257af28ee67af15fc49d2699a0080d4c
73+
buildDeps=" \
74+
bzip2 \
75+
ca-certificates \
76+
dpkg-dev \
77+
gcc \
78+
liblua5.2-dev \
79+
libnghttp2-dev=$NGHTTP2_VERSION \
80+
libpcre++-dev \
81+
libssl-dev=$OPENSSL_VERSION \
82+
libsqlite3-dev \
83+
libxml2-dev \
84+
zlib1g-dev \
85+
make \
86+
wget \
87+
"; \
88+
apt-get update; \
89+
apt-get install -y --no-install-recommends -V $buildDeps; \
90+
rm -r /var/lib/apt/lists/*; \
91+
\
92+
ddist() { \
93+
local f="$1"; shift; \
94+
local distFile="$1"; shift; \
95+
local success=; \
96+
local distUrl=; \
97+
for distUrl in $APACHE_DIST_URLS; do \
98+
if wget -O "$f" "$distUrl$distFile" && [ -s "$f" ]; then \
99+
success=1; \
100+
break; \
101+
fi; \
102+
done; \
103+
[ -n "$success" ]; \
104+
}; \
105+
\
106+
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
107+
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
108+
ddist 'subversion.tar.bz2' "subversion/subversion-$SVN_VERSION.tar.bz2"; \
109+
echo "$SVN_SHA512 *subversion.tar.bz2" | sha512sum -c -; \
110+
\
101111
# see https://httpd.apache.org/download.cgi#verify
102-
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc"; \
103-
export GNUPGHOME="$(mktemp -d)"; \
104-
for key in \
112+
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc"; \
113+
ddist 'subversion.tar.bz2.asc' "subversion/subversion-$SVN_VERSION.tar.bz2.asc"; \
114+
export GNUPGHOME="$(mktemp -d)"; \
115+
for key in \
105116
# gpg: key 791485A8: public key "Jim Jagielski (Release Signing Key) <jim@apache.org>" imported
106-
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
117+
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
107118
# gpg: key 995E35221AD84DFF: public key "Daniel Ruggeri (http://home.apache.org/~druggeri/) <druggeri@apache.org>" imported
108-
B9E8213AEFB861AF35A41F2C995E35221AD84DFF \
109-
; do \
110-
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
111-
done; \
112-
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
113-
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc; \
114-
\
115-
mkdir -p src; \
116-
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
117-
rm httpd.tar.bz2; \
118-
cd src; \
119-
\
120-
patches() { \
121-
while [ "$#" -gt 0 ]; do \
122-
local patchFile="$1"; shift; \
123-
local patchSha256="$1"; shift; \
124-
ddist "$patchFile" "httpd/patches/apply_to_$HTTPD_VERSION/$patchFile"; \
125-
echo "$patchSha256 *$patchFile" | sha256sum -c -; \
126-
patch -p0 < "$patchFile"; \
127-
rm -f "$patchFile"; \
128-
done; \
129-
}; \
130-
patches $HTTPD_PATCHES; \
131-
\
132-
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
133-
./configure \
134-
--build="$gnuArch" \
135-
--prefix="$HTTPD_PREFIX" \
136-
--enable-mods-shared=reallyall \
137-
--enable-mpms-shared=all \
138-
; \
139-
make -j "$(nproc)"; \
140-
make install; \
141-
\
142-
cd ..; \
143-
rm -r src man manual; \
144-
\
145-
sed -ri \
146-
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
147-
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
148-
"$HTTPD_PREFIX/conf/httpd.conf"; \
149-
\
150-
apt-get purge -y --auto-remove $buildDeps
151-
152-
COPY httpd-foreground /usr/local/bin/
119+
B9E8213AEFB861AF35A41F2C995E35221AD84DFF \
120+
; do \
121+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
122+
done; \
123+
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
124+
wget -O subversion.asc https://people.apache.org/keys/group/subversion.asc; \
125+
gpg --import subversion.asc; \
126+
gpg --batch --verify subversion.tar.bz2.asc subversion.tar.bz2; \
127+
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc subversion.asc subversion.tar.bz2.asc; \
128+
\
129+
mkdir -p src; \
130+
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
131+
rm httpd.tar.bz2; \
132+
cd src; \
133+
\
134+
patches() { \
135+
while [ "$#" -gt 0 ]; do \
136+
local patchFile="$1"; shift; \
137+
local patchSha256="$1"; shift; \
138+
ddist "$patchFile" "httpd/patches/apply_to_$HTTPD_VERSION/$patchFile"; \
139+
echo "$patchSha256 *$patchFile" | sha256sum -c -; \
140+
patch -p0 < "$patchFile"; \
141+
rm -f "$patchFile"; \
142+
done; \
143+
}; \
144+
patches $HTTPD_PATCHES; \
145+
\
146+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
147+
./configure \
148+
--build="$gnuArch" \
149+
--prefix="$HTTPD_PREFIX" \
150+
--enable-mods-shared=reallyall \
151+
--enable-mpms-shared=all \
152+
; \
153+
make -j "$(nproc)"; \
154+
make install; \
155+
cd ..; \
156+
\
157+
mkdir -p src-svn; \
158+
tar -xf subversion.tar.bz2 -C src-svn --strip-components=1; \
159+
rm subversion.tar.bz2; \
160+
cd src-svn; \
161+
./configure --with-lz4=internal --with-utf8proc=internal \
162+
--enable-mod-activation --with-apxs \
163+
--with-apache-libexecdir=/usr/local/apache2/modules; \
164+
make; \
165+
make install; \
166+
\
167+
cd ..; \
168+
rm -r src man manual; \
169+
\
170+
sed -ri \
171+
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
172+
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
173+
"$HTTPD_PREFIX/conf/httpd.conf"; \
174+
\
175+
apt-get purge -y --auto-remove $buildDeps
153176

154177
EXPOSE 80
155178
CMD ["httpd-foreground"]

0 commit comments

Comments
 (0)