From 6757a2f18e47f6b73a783e763034d43e75965ab4 Mon Sep 17 00:00:00 2001 From: pi-farm Date: Sun, 8 Feb 2026 16:43:08 +0100 Subject: [PATCH] add root-folder and files, Dockerfile and docker-compose.yml --- Dockerfile | 19 ++++++++++++++++ docker-compose.yml | 4 +++- root/defaults/lighttpd.conf | 22 +++++++++++++++++++ .../s6-rc.d/init-lighttpd-config/run | 19 ++++++++++++++++ .../s6-rc.d/init-lighttpd-config/type | 1 + .../s6-rc.d/svc-lighttpd/dependencies | 1 + root/etc/s6-overlay/s6-rc.d/svc-lighttpd/run | 3 +++ root/etc/s6-overlay/s6-rc.d/svc-lighttpd/type | 1 + .../s6-rc.d/user/contents.d/svc-lighttpd | 0 9 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 root/defaults/lighttpd.conf create mode 100755 root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/type create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-lighttpd/dependencies create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-lighttpd/run create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-lighttpd/type create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-lighttpd diff --git a/Dockerfile b/Dockerfile index e69de29..15bf6c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,19 @@ +# syntax=docker/dockerfile:1 + +FROM git.pi-farm.de/pi-farm/docker-baseimage-alpine:3.23 + +LABEL description="Alpine Baseimage mit s6-overlay und lighttpd" +LABEL build_version="Pi-Farm version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="Pi-Farm" + +RUN apk add --no-cache \ + lighttpd \ + lighttpd-mod_auth + +COPY root/ / + +EXPOSE 80 + +VOLUME ["/config"] + +ENTRYPOINT ["/init"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 235f332..e51455b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,9 @@ services: docker-baseimage-alpine-lighttpd: - image: git.pi-farm.de/pi-farm/docker-baseimage-alpine-lighttpd:1.0 + image: git.pi-farm.de/pi-farm/docker-baseimage-alpine-lighttpd:1.4.82 container_name: docker-baseimage-alpine-lighttpd + volume: + - ./config:/config environment: - PUID=1000 - PGID=1000 diff --git a/root/defaults/lighttpd.conf b/root/defaults/lighttpd.conf new file mode 100644 index 0000000..707ef8a --- /dev/null +++ b/root/defaults/lighttpd.conf @@ -0,0 +1,22 @@ +server.document-root = "/app/www" + +server.port = 80 + +server.username = "abc" +server.groupname = "users" + +# Mime Types laden (wichtig für CSS/JS) +include "/etc/lighttpd/mime-types.conf" + +# Module laden +server.modules += ( "mod_access", "mod_accesslog" ) + +# Index Dateien +index-file.names = ( "index.html" ) + +# Logging nach stdout/stderr für Docker +server.errorlog = "/dev/stderr" +accesslog.filename = "/dev/stdout" + +# Verhindert, dass Lighttpd im Hintergrund läuft (wichtig für s6) +server.event-handler = "linux-sysepoll" \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/run b/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/run new file mode 100755 index 0000000..fcaaf1e --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/run @@ -0,0 +1,19 @@ +#!/command/with-contenv bash + +# Standard-Verzeichnisse erstellen +mkdir -p /config /app/www + +# Config kopieren, falls nicht vorhanden +if [ ! -f /config/lighttpd.conf ]; then + echo "Keine Konfiguration gefunden, kopiere Standard..." + cp /defaults/lighttpd.conf /config/lighttpd.conf +fi + +# Dummy Index-Datei erstellen, falls leer +if [ ! -f /app/www/index.html ]; then + echo "

Es funktioniert!

Lighttpd auf Alpine.

" > /app/www/index.html +fi + +# Berechtigungen korrigieren (für User abc) +chown -R abc:users /config +chown -R abc:users /app/www \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/type b/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-lighttpd-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/dependencies b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/dependencies new file mode 100644 index 0000000..ae5f393 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/dependencies @@ -0,0 +1 @@ +init-lighttpd-config \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/run b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/run new file mode 100755 index 0000000..ca7659c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/run @@ -0,0 +1,3 @@ +#!/command/with-contenv bash +# Startet lighttpd im Vordergrund (-D) mit der Config aus dem Volume +exec lighttpd -D -f /config/lighttpd.conf \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/type b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/type new file mode 100644 index 0000000..1780f9f --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-lighttpd/type @@ -0,0 +1 @@ +longrun \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-lighttpd b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-lighttpd new file mode 100644 index 0000000..e69de29