From 3e8302150959aca54505b3fce71b974cd2125c7b Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 27 Apr 2026 09:27:51 -0700 Subject: [PATCH] Stand up gitweb as interim web view MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Gitweb ships with git (already built from source), so adding it is just a build step, lighttpd, perl, and two config files. The container entrypoint is now lighttpd instead of quire serve — SSH dispatch via docker exec still works since quire stays on the PATH. All gitweb additions are tagged TODO(vys) for easy grep when the native web view replaces them. Assisted-by: GLM-5.1 via pi --- Dockerfile | 20 +++++++++++++++++--- conf/gitweb.conf | 7 +++++++ conf/lighttpd.conf | 13 +++++++++++++ docs/host/README.md | 7 +++++-- 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 conf/gitweb.conf create mode 100644 conf/lighttpd.conf diff --git a/Dockerfile b/Dockerfile index 7b71f15..375e3a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,10 @@ RUN curl -fsSL https://github.com/git/git/archive/refs/tags/v${GIT_VERSION}.tar. | tar xz \ && cd git-${GIT_VERSION} \ && make -j$(nproc) prefix=/usr/local NO_TCLTK=1 NO_GETTEXT= \ - && make prefix=/usr/local install + && make prefix=/usr/local install \ + && make -j$(nproc) prefix=/usr/local NO_TCLTK=1 NO_GETTEXT= gitweb \ + && make prefix=/usr/local install-gitweb +# TODO(vys): remove gitweb build when quire serve has its own web view # Cargo-chef stage for dependency caching. FROM rust:1.88-trixie AS chef @@ -64,10 +67,16 @@ RUN apt-get update \ ca-certificates \ libcurl4 \ libexpat1 \ + lighttpd \ + perl \ && rm -rf /var/lib/apt/lists/* +# TODO(vys): lighttpd and perl are interim deps for gitweb; remove both +# when quire serve has its own web view. COPY --from=git-builder /usr/local/bin/git /usr/local/bin/git COPY --from=git-builder /usr/local/libexec/git-core/ /usr/local/libexec/git-core/ +COPY --from=git-builder /usr/local/share/gitweb/ /usr/local/share/gitweb/ +# TODO(vys): remove the gitweb COPY above with gitweb COPY --from=builder /build/quire /usr/local/bin/quire # Configure git hooks globally so all repos inherit the post-receive dispatch. @@ -83,5 +92,10 @@ RUN mkdir -p /var/quire/repos /var/quire/runs WORKDIR /var/quire -ENTRYPOINT ["quire"] -CMD ["serve"] +# TODO(vys): everything below is interim gitweb scaffolding — remove when +# quire serve has its own web view. Restore ENTRYPOINT ["quire"] / CMD ["serve"]. +COPY conf/gitweb.conf /etc/gitweb.conf +COPY conf/lighttpd.conf /etc/lighttpd/lighttpd.conf + +EXPOSE 8080 +ENTRYPOINT ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"] diff --git a/conf/gitweb.conf b/conf/gitweb.conf new file mode 100644 index 0000000..1a45558 --- /dev/null +++ b/conf/gitweb.conf @@ -0,0 +1,7 @@ +# Interim gitweb config — remove when quire serve has its own web view. +# See TODO(vys) in the Dockerfile. + +our $projectroot = "/var/quire/repos"; + +our $feature{'blame'}{'default'} = [1]; +our $feature{'highlight'}{'default'} = [1]; diff --git a/conf/lighttpd.conf b/conf/lighttpd.conf new file mode 100644 index 0000000..e44672a --- /dev/null +++ b/conf/lighttpd.conf @@ -0,0 +1,13 @@ +# Interim lighttpd config — remove when quire serve has its own web view. +# See TODO(vys) in the Dockerfile. + +server.document-root = "/usr/local/share/gitweb" +server.port = 8080 +server.modules = ("mod_cgi") + +# Write runtime files to /tmp since the container runs as a non-root user. +server.pid-file = "/tmp/lighttpd.pid" +server.errorlog = "/tmp/lighttpd-error.log" + +index-file.names = ("gitweb.cgi") +cgi.assign = (".cgi" => "") diff --git a/docs/host/README.md b/docs/host/README.md index 1f56d8f..00fe1db 100644 --- a/docs/host/README.md +++ b/docs/host/README.md @@ -33,7 +33,7 @@ Reference configs for dispatching SSH connections into the quire container. --user "$(id -u git):$(id -g git)" \ -e HOME=/tmp \ -v /var/quire:/var/quire \ - -p 127.0.0.1:3000:3000 \ + -p 127.0.0.1:8080:8080 \ quire In a compose file, the equivalent is `user: "${QUIRE_UID}:${QUIRE_GID}"` @@ -63,6 +63,9 @@ otherwise match a container user. `HOME=/tmp` is set because the host uid has no `/etc/passwd` entry inside the container, and git needs a writable `HOME` for its config probing. -The HTTP port (3000) is published to host loopback only. A reverse proxy +The HTTP port (8080) is published to host loopback only. A reverse proxy on the host terminates TLS and reverse-proxies to it; nothing else should reach it directly. + +Currently the container runs lighttpd + gitweb as an interim web view. +This will be replaced by `quire serve` once the built-in web view is ready. -- 2.54.0