Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add httpd:2.4.46-alpine #18

Merged
merged 2 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions apache/httpd/2.4.39-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
FROM lcr.loongnix.cn/library/alpine:3.19

LABEL maintainer="[email protected]"

RUN set -x \
# && addgroup -g 82 -S www-data \ #The www-data group has been created by default in alpine:3.19
&& adduser -u 82 -D -S -G www-data www-data
# 82 is the standard uid/gid for "www-data" in Alpine

ENV HTTPD_PREFIX /usr/local/apache2
ENV PATH $HTTPD_PREFIX/bin:$PATH
RUN mkdir -p "$HTTPD_PREFIX" \
&& chown www-data:www-data "$HTTPD_PREFIX"
WORKDIR $HTTPD_PREFIX

ENV HTTPD_VERSION 2.4.39
ENV HTTPD_SHA256 b4ca9d05773aa59b54d66cd8f4744b945289f084d3be17d7981d1783a5decfa2

ENV HTTPD_PATCHES="fix-unknown-xmlChar-error.patch"
ADD fix-unknown-xmlChar-error.patch .

ENV APACHE_DIST_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
https://www-us.apache.org/dist/ \
https://www.apache.org/dist/ \
https://archive.apache.org/dist/

RUN set -eux; \
\
runDeps=' \
apr-dev \
apr-util-dev \
apr-util-ldap \
perl \
'; \
apk add --no-cache --virtual .build-deps \
$runDeps \
ca-certificates \
coreutils \
dpkg-dev dpkg \
gcc \
gnupg \
libc-dev \
# mod_proxy_html mod_xml2enc
libxml2-dev \
# mod_lua
lua-dev \
make \
# mod_http2
nghttp2-dev \
# mod_session_crypto
openssl \
openssl-dev \
pcre-dev \
tar \
# mod_deflate
zlib-dev \
patch \
; \
\
ddist() { \
local f="$1"; shift; \
local distFile="$1"; shift; \
local success=; \
local distUrl=; \
for distUrl in $APACHE_DIST_URLS; do \
if wget -O "$f" "$distUrl$distFile" && [ -s "$f" ]; then \
success=1; \
break; \
fi; \
done; \
[ -n "$success" ]; \
}; \
\
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
\
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc";
RUN export GNUPGHOME="$(mktemp -d)"; \
for key in \
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
B9E8213AEFB861AF35A41F2C995E35221AD84DFF \
; do \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
done; \
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
command -v gpgconf && gpgconf --kill all || :; \
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc; \
\
mkdir -p src; \
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
rm httpd.tar.bz2; \
mv $HTTPD_PATCHES src && \
cd src; \
wget -O ./build/config.sub "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"; \
wget -O ./build/config.guess "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"; \
\
patch -p1 < $HTTPD_PATCHES; \
\
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--prefix="$HTTPD_PREFIX" \
--enable-mods-shared=reallyall \
--enable-mpms-shared=all \
; \
make -j "$(nproc)"; \
make install; \
\
cd ..; \
rm -r src man manual; \
\
sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
-e 's!^(\s*TransferLog)\s+\S+!\1 /proc/self/fd/1!g' \
"$HTTPD_PREFIX/conf/httpd.conf" \
"$HTTPD_PREFIX/conf/extra/httpd-ssl.conf" \
; \
\
runDeps="$runDeps $( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .httpd-rundeps $runDeps; \
apk del .build-deps; \
\
httpd -v

COPY httpd-foreground /usr/local/bin/

EXPOSE 80
CMD ["httpd-foreground"]
20 changes: 20 additions & 0 deletions apache/httpd/2.4.39-alpine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is generated by the template.

REGISTRY?=lcr.loongnix.cn
ORGANIZATION?=apache
REPOSITORY?=httpd
TAG?=2.4.39-alpine

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)


default: image

image:
docker build \
-t $(IMAGE) \
.

push:
echo "scan test"
docker push $(IMAGE)
12 changes: 12 additions & 0 deletions apache/httpd/2.4.39-alpine/fix-unknown-xmlChar-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/modules/filters/mod_xml2enc.c b/modules/filters/mod_xml2enc.c
index 76046b4..f5b3cc7 100644
--- a/modules/filters/mod_xml2enc.c
+++ b/modules/filters/mod_xml2enc.c
@@ -36,6 +36,7 @@

/* libxml2 */
#include <libxml/encoding.h>
+#include <libxml/xmlstring.h>

#if defined(__clang__)
#pragma clang diagnostic pop
7 changes: 7 additions & 0 deletions apache/httpd/2.4.39-alpine/httpd-foreground
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

# Apache gets grumpy about PID files pre-existing
rm -f /usr/local/apache2/logs/httpd.pid

exec httpd -DFOREGROUND "$@"
203 changes: 203 additions & 0 deletions apache/httpd/2.4.46-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
FROM lcr.loongnix.cn/library/alpine:3.19

LABEL maintainer="[email protected]"

RUN set -x \
# && addgroup -g 82 -S www-data \ #The www-data group has been created by default in alpine:3.19
&& adduser -u 82 -D -S -G www-data www-data
# 82 is the standard uid/gid for "www-data" in Alpine

ENV HTTPD_PREFIX /usr/local/apache2
ENV PATH $HTTPD_PREFIX/bin:$PATH
RUN mkdir -p "$HTTPD_PREFIX" \
&& chown www-data:www-data "$HTTPD_PREFIX"
WORKDIR $HTTPD_PREFIX

ENV HTTPD_VERSION 2.4.46
ENV HTTPD_SHA256=740eddf6e1c641992b22359cabc66e6325868c3c5e2e3f98faf349b61ecf41ea

ENV HTTPD_PATCHES="fix-unknown-xmlChar-error.patch"
ADD fix-unknown-xmlChar-error.patch .

ENV APACHE_DIST_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
https://www-us.apache.org/dist/ \
https://www.apache.org/dist/ \
https://archive.apache.org/dist/

RUN set -eux; \
\
runDeps=' \
apr \
apr-util \
apr-util-ldap \
perl \
'; \
apk add --no-cache --virtual .build-deps \
$runDeps \
apr-dev \
apr-util-dev \
ca-certificates \
coreutils \
dpkg-dev dpkg \
gcc \
gnupg \
libc-dev \
curl-dev \
jansson-dev \
# mod_proxy_html mod_xml2enc
libxml2-dev \
# mod_lua
lua-dev \
make \
# mod_http2
nghttp2-dev \
# mod_session_crypto
openssl \
openssl-dev \
pcre-dev \
tar \
# mod_deflate
zlib-dev \
brotli-dev \
patch \
; \
\
ddist() { \
local f="$1"; shift; \
local distFile="$1"; shift; \
local success=; \
local distUrl=; \
for distUrl in $APACHE_DIST_URLS; do \
if wget -O "$f" "$distUrl$distFile" && [ -s "$f" ]; then \
success=1; \
break; \
fi; \
done; \
[ -n "$success" ]; \
}; \
\
ddist 'httpd.tar.bz2' "httpd/httpd-$HTTPD_VERSION.tar.bz2"; \
echo "$HTTPD_SHA256 *httpd.tar.bz2" | sha256sum -c -; \
\
ddist 'httpd.tar.bz2.asc' "httpd/httpd-$HTTPD_VERSION.tar.bz2.asc";
RUN export GNUPGHOME="$(mktemp -d)"; \
for key in \
DE29FB3971E71543FD2DC049508EAEC5302DA568 \
# Rodent of Unusual Size <[email protected]>
13155B0E9E634F42BF6C163FDDBA64BA2C312D2F \
# Jim Jagielski <[email protected]>
8B39757B1D8A994DF2433ED58B3A601F08C975E5 \
# Dean Gaudet <[email protected]>
31EE1A81B8D066548156D37B7D6DBFD1F08E012A \
# Cliff Woolley <[email protected]>
A10208FEC3152DD7C0C9B59B361522D782AB7BD1 \
# Cliff Woolley <[email protected]>
3DE024AFDA7A4B15CB6C14410F81AA8AB0D5F771 \
# Graham Leggett <[email protected]>
EB138C6AF0FC691001B16D93344A844D751D7F27 \
# Roy T. Fielding <[email protected]>
CBA5A7C21EC143314C41393E5B968010E04F9A89 \
# Justin R. Erenkrantz <[email protected]>
3C016F2B764621BB549C66B516A96495E2226795 \
# Aaron Bannert <[email protected]>
937FB3994A242BA9BF49E93021454AF0CC8B0F7E \
# Brad Nicholes <[email protected]>
EAD1359A4C0F2D37472AAF28F55DF0293A4E7AC9 \
# Sander Striker <[email protected]>
4C1EADADB4EF5007579C919C6635B6C0DE885DD3 \
# Greg Stein <[email protected]>
01E475360FCCF1D0F24B9D145D414AE1E005C9CB \
# Andre Malo <[email protected]>
92CCEF0AA7DD46AC3A0F498BCA6939748103A37E \
# Erik Abele <[email protected]>
D395C7573A68B9796D38C258153FA0CD75A67692 \
# Astrid Kessler (Kess) <[email protected]>
FA39B617B61493FD283503E7EED1EA392261D073 \
# Joe Schaefer <[email protected]>
984FB3350C1D5C7A3282255BB31B213D208F5064 \
# Stas Bekman <[email protected]>
FE7A49DAA875E890B4167F76CCB2EB46E76CF6D0 \
# Paul Querna <[email protected]>
39F6691A0ECF0C50E8BB849CF78875F642721F00 \
# Colm MacCarthaigh <[email protected]>
29A2BA848177B73878277FA475CAA2A3F39B3750 \
# Ruediger Pluem <[email protected]>
120A8667241AEDD4A78B46104C042818311A3DE5 \
# Nick Kew <[email protected]>
453510BDA6C5855624E009236D0BC73A40581837 \
# Philip M. Gollucci <[email protected]>
0DE5C55C6BF3B2352DABB89E13249B4FEC88A0BF \
# Bojan Smojver <[email protected]>
7CDBED100806552182F98844E8E7E00B4DAA1988 \
# Issac Goldstand <[email protected]>
A8BA9617EF3BCCAC3B29B869EDB105896F9522D8 \
# "Guenter Knauf" ("CODE SIGNING KEY") <[email protected]>
3E6AC004854F3A7F03566B592FF06894E55B0D0E \
# Jeff Trawick (CODE SIGNING KEY) <[email protected]>
5B5181C2C0AB13E59DA3F7A3EC582EB639FF092C \
# Jim Jagielski (Release Signing Key) <[email protected]>
A93D62ECC3C8EA12DB220EC934EA76E6791485A8 \
# Eric Covener <[email protected]>
65B2D44FE74BD5E3DE3AC3F082781DE46D5954FA \
# Yann Ylavic <[email protected]>
8935926745E1CE7E3ED748F6EC99EE267EB5F61A \
# Daniel Ruggeri (http\x3a//home.apache.org/~druggeri/) <[email protected]>
E3480043595621FE56105F112AB12A7ADC55C003 \
# Joe Orton (Release Signing Key) <[email protected]>
93525CFCF6FDFFB3FD9700DD5A4B10AE43B56A27 \
# Christophe JAILLET <[email protected]>
C55AB7B9139EB2263CD1AABC19B033D1760C227B \
; do \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \
done; \
gpg --batch --verify httpd.tar.bz2.asc httpd.tar.bz2; \
command -v gpgconf && gpgconf --kill all || :; \
rm -rf "$GNUPGHOME" httpd.tar.bz2.asc; \
\
mkdir -p src; \
tar -xf httpd.tar.bz2 -C src --strip-components=1; \
rm httpd.tar.bz2; \
mv $HTTPD_PATCHES src && \
cd src; \
wget -O ./build/config.sub "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"; \
wget -O ./build/config.guess "git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"; \
\
patch -p1 < $HTTPD_PATCHES; \
\
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
./configure \
--build="$gnuArch" \
--prefix="$HTTPD_PREFIX" \
--enable-mods-shared=reallyall \
--enable-mpms-shared=all \
; \
make -j "$(nproc)"; \
make install; \
\
cd ..; \
rm -r src man manual; \
\
sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
-e 's!^(\s*TransferLog)\s+\S+!\1 /proc/self/fd/1!g' \
"$HTTPD_PREFIX/conf/httpd.conf" \
"$HTTPD_PREFIX/conf/extra/httpd-ssl.conf" \
; \
\
runDeps="$runDeps $( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .httpd-rundeps $runDeps; \
apk del .build-deps; \
\
httpd -v

COPY httpd-foreground /usr/local/bin/

EXPOSE 80
CMD ["httpd-foreground"]
Loading