From e478c06320b6bd6e311348bb02f0f952f3586d51 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Fri, 23 Jun 2023 20:51:56 +0300
Subject: [PATCH] Add httpd:bookworm.

---
 .gitlab-ci.yml               | 23 ++++++++++++++++++++---
 httpd/bookworm/.dockerignore |  1 +
 httpd/bookworm/Dockerfile    | 30 ++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 httpd/bookworm/.dockerignore
 create mode 100644 httpd/bookworm/Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ead83df..d666ad1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -43,19 +43,36 @@ push-cgit:
 build-httpd:
   extends: .container-build-base
   variables:
-    CONTEXT: httpd/bullseye
+    CONTEXT: httpd/bookworm
 
 push-httpd:
   extends: .container-push-base
   variables:
-    CONTEXT: httpd/bullseye
+    CONTEXT: httpd/bookworm
     IMAGE: httpd
   needs:
     - job: build-httpd
       artifacts: true
 
+# httpd bookworm image:
+
+push-httpd-bookworm:
+  extends: .container-push-base
+  variables:
+    CONTEXT: httpd/bookworm
+    IMAGE: httpd
+    TAG: bookworm
+  needs:
+    - job: build-httpd
+      artifacts: true
+
 # httpd bullseye image:
 
+build-httpd-bullseye:
+  extends: .container-build-base
+  variables:
+    CONTEXT: httpd/bullseye
+
 push-httpd-bullseye:
   extends: .container-push-base
   variables:
@@ -63,7 +80,7 @@ push-httpd-bullseye:
     IMAGE: httpd
     TAG: bullseye
   needs:
-    - job: build-httpd
+    - job: build-httpd-bullseye
       artifacts: true
 
 # httpd buster image:
diff --git a/httpd/bookworm/.dockerignore b/httpd/bookworm/.dockerignore
new file mode 100644
index 0000000..72e8ffc
--- /dev/null
+++ b/httpd/bookworm/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/httpd/bookworm/Dockerfile b/httpd/bookworm/Dockerfile
new file mode 100644
index 0000000..b869f2b
--- /dev/null
+++ b/httpd/bookworm/Dockerfile
@@ -0,0 +1,30 @@
+FROM registry.hub.docker.com/library/debian:bookworm-slim
+ENV APACHE_RUN_DIR=/run/apache2 \
+    APACHE_LOCK_DIR=/var/lock/apache2 \
+    APACHE_LOG_DIR=/var/log/apache2 \
+    APACHE_RUN_USER=www-data \
+    APACHE_RUN_GROUP=www-data \
+    APACHE_PID_FILE=/run/apache2/apache2.pid
+# hadolint ignore=DL3008,DL3015
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y \
+        apache2 \
+        libcap2-bin \
+        wget \
+    && \
+    setcap CAP_NET_BIND_SERVICE=+ep /usr/sbin/apache2 && \
+    DEBIAN_FRONTEND=noninteractive apt-get purge --auto-remove -y libcap2-bin && \
+    a2enmod status && \
+    install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_RUN_DIR" && \
+    install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOCK_DIR" && \
+    install -d -o "$APACHE_RUN_USER" -g "$APACHE_RUN_GROUP" -m 755 "$APACHE_LOG_DIR" && \
+    ln -sf /dev/stdout "$APACHE_LOG_DIR/access.log" && \
+    ln -sf /dev/stderr "$APACHE_LOG_DIR/error.log" && \
+    ln -sf /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" && \
+    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
+RUN apache2 -t
+EXPOSE 80
+CMD [ "apache2", "-DFOREGROUND" ]
+USER "www-data"
+WORKDIR /var/www
+HEALTHCHECK CMD wget --spider --quiet http://localhost/server-status --user-agent 'Healthcheck' || exit 1
-- 
GitLab