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.38-alpine #17

Merged
merged 1 commit 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.38-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.38
ENV HTTPD_SHA256 7dc65857a994c98370dc4334b260101a7a04be60e6e74a5c57a6dee1bc8f394a

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.38-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.38-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.38-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.38-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 "$@"