Skip to content
This repository was archived by the owner on Apr 19, 2022. It is now read-only.

Commit fcb6037

Browse files
committed
Add wodby images
1 parent 7976cab commit fcb6037

File tree

7 files changed

+390
-26
lines changed

7 files changed

+390
-26
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

.travis.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
language: bash
2-
services: docker
32

4-
env:
5-
- VERSION=2.4
6-
- VERSION=2.4 VARIANT=alpine
7-
- VERSION=2.2
8-
- VERSION=2.2 VARIANT=alpine
3+
sudo: required
94

10-
install:
11-
- git clone https://github.com/docker-library/official-images.git ~/official-images
5+
services:
6+
- docker
127

13-
before_script:
14-
- env | sort
15-
- cd "$VERSION/$VARIANT"
16-
- image="httpd:${VERSION}${VARIANT:+-$VARIANT}"
8+
env:
9+
global:
10+
- LATEST_VERSION=2.4
11+
matrix:
12+
- VERSION=2.4
13+
- VERSION=2.2
1714

1815
script:
19-
- travis_retry docker build -t "$image" .
20-
- ~/official-images/test/run.sh "$image"
16+
- cd ./"${VERSION}"/alpine
17+
- make
18+
19+
after_success: |
20+
if [[ "${TRAVIS_PULL_REQUEST}" == "false" && ("${TRAVIS_BRANCH}" == "master" || -n "${TRAVIS_TAG}") ]]; then
21+
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}"
22+
make release
2123
22-
after_script:
23-
- docker images
24+
if [[ "${VERSION}" == "${LATEST_VERSION}" ]]; then
25+
make release TAG="latest"
26+
fi
27+
fi
2428
25-
# vim:set et ts=2 sw=2:
29+
notifications:
30+
slack:
31+
on_success: always
32+
secure: OvMmlq3dGMtpXuNp8bdMnYZjHISDU53AxJe6tswFNHkRlcdTlnT10lWFd3B+DdBOk8YqrEy1FLkdKpaBtHwiinnVSfrVjmwQwHMTbLZkpSWDPYWILSFu+Y/6Las4rAIjy6gbsqiZLqc4phisJFhLxeg+BJnii6q++VHp4oWf0zqeXx5H18gPWMRUtp50+FakyQWUX91F7IB/FZ2wDTpYUMANDgVNPhqiqs76Cz4JQZkzPsstLNcyzbxwBceqhWf3K30VvyTunG9lv/kSeM0qNO0yCl2UcoQ9aRhF64A5SeoeszNgM3yO+JzFjCP8Jr3TOgiMB72l5RFM1PGMHqw4EMm7ewE5M/79B5HT3PJ2+EwR16a0z+H7hyPGnlRX5pjnHXnezPN5VYpjO2+FheMF7j4lRji5CzLiPbVgsHyz2hF/54kKTm5zQx9EPNpD0UGns4PdqKzCI2YSLsW5Q8Gf5Jw1sge+0mxA+L3dZrZLhI4wucuWyCOxX90oDjUTKVNq6PvJ4zg2mt1s0fENTjjKP94pUw3ocw8HThD/j5pbjlBDnPJeiWpKiU6E2FwUyWX8nZp31KlFTIKYn6iQu0+6K8iXZozta0HfZjlsUCDSAXhuxPyxid+zsBpQBAJ6w1qsr4oBGULvKqraxby+ZrH3z9bt7SvXd0zfGTLF8NTi7VM=

2.2/alpine/Dockerfile.wodby

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# this cannot upgrade to Alpine 3.5 due to https://github.com/libressl-portable/portable/issues/147
2+
# given that 2.2.x is a "legacy branch", and is in security-fixes-only mode upstream, this should be reasonably fine
3+
# "Minimal maintenance patches of 2.2.x are expected throughout this period, and users are strongly encouraged to promptly complete their transitions to the the 2.4.x flavour of httpd to benefit from a much larger assortment of minor security and bug fixes as well as new features."
4+
# https://httpd.apache.org/
5+
FROM wodby/alpine:3.4-1.0.0
6+
7+
# ensure www-data user exists
8+
RUN set -x \
9+
&& addgroup -g 82 -S www-data \
10+
&& adduser -u 82 -D -S -G www-data www-data
11+
# 82 is the standard uid/gid for "www-data" in Alpine
12+
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
13+
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
14+
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
15+
16+
ENV HTTPD_PREFIX /usr/local/apache2
17+
ENV PATH $HTTPD_PREFIX/bin:$PATH
18+
RUN mkdir -p "$HTTPD_PREFIX" \
19+
&& chown www-data:www-data "$HTTPD_PREFIX"
20+
WORKDIR $HTTPD_PREFIX
21+
22+
ENV HTTPD_VERSION 2.2.34
23+
ENV HTTPD_SHA256 e53183d5dfac5740d768b4c9bea193b1099f4b06b57e5f28d7caaf9ea7498160
24+
25+
# https://httpd.apache.org/security/vulnerabilities_22.html
26+
ENV HTTPD_PATCHES="CVE-2017-9798-patch-2.2.patch 42c610f8a8f8d4d08664db6d9857120c2c252c9b388d56f238718854e6013e46"
27+
28+
ENV APACHE_DIST_URLS \
29+
# https://issues.apache.org/jira/browse/INFRA-8753?focusedCommentId=14735394#comment-14735394
30+
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
31+
# if the version is outdated (or we're grabbing the .asc file), we might have to pull from the dist/archive :/
32+
https://www-us.apache.org/dist/ \
33+
https://www.apache.org/dist/ \
34+
https://archive.apache.org/dist/
35+
36+
# see https://httpd.apache.org/docs/2.2/install.html#requirements
37+
RUN set -eux; \
38+
\
39+
runDeps=' \
40+
apr-dev \
41+
apr-util-dev \
42+
apr-util-ldap \
43+
perl \
44+
'; \
45+
apk add --no-cache --virtual .build-deps \
46+
$runDeps \
47+
ca-certificates \
48+
coreutils \
49+
dpkg-dev dpkg \
50+
gcc \
51+
gnupg \
52+
libc-dev \
53+
make \
54+
openssl \
55+
openssl-dev \
56+
pcre-dev \
57+
tar \
58+
# install GNU wget (Busybox wget in Alpine 3.4 gives us "wget: error getting response: Connection reset by peer" for some reason)
59+
wget \
60+
; \
61+
\
62+
ddist() { \
63+
local f="$1"; shift; \
64+
local distFile="$1"; shift; \
65+
local success=; \
66+
local distUrl=; \
67+
for distUrl in $APACHE_DIST_URLS; do \
68+
if wget -O "$f" "$distUrl$distFile"; then \
69+
success=1; \
70+
break; \
71+
fi; \
72+
done; \
73+
[ -n "$success" ]; \
74+
}; \
75+
\
76+
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
77+
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
78+
\
79+
# see https://httpd.apache.org/download.cgi#verify
80+
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc"; \
81+
export GNUPGHOME="$(mktemp -d)"; \
82+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B1B96F45DFBDCCF974019235193F180AB55D9977; \
83+
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
84+
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc; \
85+
\
86+
mkdir -p src; \
87+
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
88+
rm httpd.tar.bz2; \
89+
cd src; \
90+
\
91+
patches() { \
92+
while [ "$#" -gt 0 ]; do \
93+
local patchFile="$1"; shift; \
94+
local patchSha256="$1"; shift; \
95+
ddist "$patchFile" "httpd/patches/apply_to_$HTTPD_VERSION/$patchFile"; \
96+
echo "$patchSha256 *$patchFile" | sha256sum -c -; \
97+
patch -p0 < "$patchFile"; \
98+
rm -f "$patchFile"; \
99+
done; \
100+
}; \
101+
patches $HTTPD_PATCHES; \
102+
\
103+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
104+
./configure \
105+
--build="$gnuArch" \
106+
--prefix="$HTTPD_PREFIX" \
107+
--with-mpm=event \
108+
# https://httpd.apache.org/docs/2.2/programs/configure.html
109+
# Caveat: --enable-mods-shared=all does not actually build all modules. To build all modules then, one might use:
110+
--enable-mods-shared='all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap charset_lite dav_lock disk_cache' \
111+
; \
112+
make -j "$(nproc)"; \
113+
make install; \
114+
\
115+
cd ..; \
116+
rm -r src man manual; \
117+
\
118+
sed -ri \
119+
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
120+
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
121+
"$HTTPD_PREFIX/conf/httpd.conf"; \
122+
\
123+
runDeps="$runDeps $( \
124+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
125+
| tr ',' '\n' \
126+
| sort -u \
127+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
128+
)"; \
129+
apk add --virtual .httpd-rundeps $runDeps; \
130+
apk del .build-deps
131+
132+
COPY httpd-foreground /usr/local/bin/
133+
134+
EXPOSE 80
135+
CMD ["httpd-foreground"]

2.2/alpine/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
-include env_make
2+
3+
TAG ?= 2.2.34
4+
REPO = wodby/httpd
5+
NAME = httpd-2.2.34
6+
7+
.PHONY: build test push shell run start stop logs clean release
8+
9+
default: build
10+
11+
build:
12+
docker build -t $(REPO):$(TAG) -f Dockerfile.wodby ./
13+
14+
test:
15+
IMAGE=$(REPO):$(TAG) ./test.sh
16+
17+
push:
18+
docker push $(REPO):$(TAG)
19+
20+
shell:
21+
docker run --rm --name $(NAME) -i -t $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) /bin/bash
22+
23+
run:
24+
docker run --rm --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) $(CMD)
25+
26+
start:
27+
docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)
28+
29+
stop:
30+
docker stop $(NAME)
31+
32+
logs:
33+
docker logs $(NAME)
34+
35+
clean:
36+
-docker rm -f $(NAME)
37+
38+
release: build push

2.4/alpine/Dockerfile.wodby

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
FROM wodby/alpine:3.6-1.0.0
2+
3+
# ensure www-data user exists
4+
RUN set -x \
5+
&& addgroup -g 82 -S www-data \
6+
&& adduser -u 82 -D -S -G www-data www-data
7+
# 82 is the standard uid/gid for "www-data" in Alpine
8+
# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2
9+
# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2
10+
# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2
11+
12+
ENV HTTPD_PREFIX /usr/local/apache2
13+
ENV PATH $HTTPD_PREFIX/bin:$PATH
14+
RUN mkdir -p "$HTTPD_PREFIX" \
15+
&& chown www-data:www-data "$HTTPD_PREFIX"
16+
WORKDIR $HTTPD_PREFIX
17+
18+
ENV HTTPD_VERSION 2.4.29
19+
ENV HTTPD_SHA256 777753a5a25568a2a27428b2214980564bc1c38c1abf9ccc7630b639991f7f00
20+
21+
# https://httpd.apache.org/security/vulnerabilities_24.html
22+
ENV HTTPD_PATCHES=""
23+
24+
ENV APACHE_DIST_URLS \
25+
# https://issues.apache.org/jira/browse/INFRA-8753?focusedCommentId=14735394#comment-14735394
26+
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
27+
# if the version is outdated (or we're grabbing the .asc file), we might have to pull from the dist/archive :/
28+
https://www-us.apache.org/dist/ \
29+
https://www.apache.org/dist/ \
30+
https://archive.apache.org/dist/
31+
32+
# see https://httpd.apache.org/docs/2.4/install.html#requirements
33+
RUN set -eux; \
34+
\
35+
runDeps=' \
36+
apr-dev \
37+
apr-util-dev \
38+
apr-util-ldap \
39+
perl \
40+
'; \
41+
apk add --no-cache --virtual .build-deps \
42+
$runDeps \
43+
ca-certificates \
44+
coreutils \
45+
dpkg-dev dpkg \
46+
gcc \
47+
gnupg \
48+
libc-dev \
49+
# mod_session_crypto
50+
libressl \
51+
libressl-dev \
52+
# mod_proxy_html mod_xml2enc
53+
libxml2-dev \
54+
# mod_lua
55+
lua-dev \
56+
make \
57+
# mod_http2
58+
nghttp2-dev \
59+
pcre-dev \
60+
tar \
61+
# mod_deflate
62+
zlib-dev \
63+
; \
64+
\
65+
ddist() { \
66+
local f="$1"; shift; \
67+
local distFile="$1"; shift; \
68+
local success=; \
69+
local distUrl=; \
70+
for distUrl in $APACHE_DIST_URLS; do \
71+
if wget -O "$f" "$distUrl$distFile"; then \
72+
success=1; \
73+
break; \
74+
fi; \
75+
done; \
76+
[ -n "$success" ]; \
77+
}; \
78+
\
79+
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
80+
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
81+
\
82+
# see https://httpd.apache.org/download.cgi#verify
83+
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc"; \
84+
export GNUPGHOME="$(mktemp -d)"; \
85+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys A93D62ECC3C8EA12DB220EC934EA76E6791485A8; \
86+
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
87+
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc; \
88+
\
89+
mkdir -p src; \
90+
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
91+
rm httpd.tar.bz2; \
92+
cd src; \
93+
\
94+
patches() { \
95+
while [ "$#" -gt 0 ]; do \
96+
local patchFile="$1"; shift; \
97+
local patchSha256="$1"; shift; \
98+
ddist "$patchFile" "httpd/patches/apply_to_$HTTPD_VERSION/$patchFile"; \
99+
echo "$patchSha256 *$patchFile" | sha256sum -c -; \
100+
patch -p0 < "$patchFile"; \
101+
rm -f "$patchFile"; \
102+
done; \
103+
}; \
104+
patches $HTTPD_PATCHES; \
105+
\
106+
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
107+
./configure \
108+
--build="$gnuArch" \
109+
--prefix="$HTTPD_PREFIX" \
110+
--enable-mods-shared=reallyall \
111+
--with-mpm=event \
112+
; \
113+
make -j "$(nproc)"; \
114+
make install; \
115+
\
116+
cd ..; \
117+
rm -r src man manual; \
118+
\
119+
sed -ri \
120+
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
121+
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
122+
"$HTTPD_PREFIX/conf/httpd.conf"; \
123+
\
124+
runDeps="$runDeps $( \
125+
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
126+
| tr ',' '\n' \
127+
| sort -u \
128+
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
129+
)"; \
130+
apk add --virtual .httpd-rundeps $runDeps; \
131+
apk del .build-deps
132+
133+
COPY httpd-foreground /usr/local/bin/
134+
135+
EXPOSE 80
136+
CMD ["httpd-foreground"]

0 commit comments

Comments
 (0)