From 00dffa8cf5cac8322cb47f2222e424d3960e7939 Mon Sep 17 00:00:00 2001 From: RATDAD Date: Sat, 13 Dec 2025 21:00:08 -0500 Subject: Added Git Smart HTTP Support --- Dockerfile | 61 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 16 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index f510d84..448e1c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,64 @@ # # -# cgit Docker Container - -FROM rockylinux:9 -LABEL MAINTAINER="RATDAD " +# cgit-http-server Docker Container +################### +# Build Stage +################### +FROM rockylinux:9 AS builder # Update everything; install dependencies. -RUN dnf -y update && dnf -y upgrade \ - && dnf install -y git gcc make openssl-devel zlib-devel zip \ - highlight httpd pip \ +RUN dnf -y update && dnf -y install \ + git gcc make \ + openssl-devel zlib-devel zip \ + highlight \ && dnf clean all -# Install cgit. -RUN git clone https://git.zx2c4.com/cgit -ADD cgit.conf cgit -RUN cd cgit \ - && git submodule init \ +# Build cgit. +RUN git clone https://git.zx2c4.com/cgit /build/cgit +WORKDIR /build/cgit +# Add compile-time config (cgit.conf). +ADD cgit.conf . +RUN git submodule init \ && git submodule update \ && make NO_LUA=1 \ - && make install \ - && cd .. \ - && rm -rf cgit + && make install DESTDIR=/build/install + +################### +# Runtime Stage +################### +FROM rockylinux:9 +LABEL MAINTAINER="RATDAD " -# Configure. +# Runtime dependencies +RUN dnf -y update && dnf -y install \ + httpd git highlight \ + openssl zlib zip \ + && dnf clean all + +# Install cgit artifacts. +COPY --from=builder /build/install / + +# If set to 0, the container will not \ +# handle git-http-backend for you. +ENV GIT_HTTP_MODE=0 + +# Configure Apache and cgit. ADD etc/cgitrc /etc/cgitrc ADD etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf +# Configure Git HTTP Modes. +ADD etc/httpd/conf.d/git-http-p.conf /etc/httpd/conf.d/git-http-p.conf +ADD etc/httpd/conf.d/git-http-cf.conf /etc/httpd/conf.d/git-http-cf.conf +ADD etc/httpd/conf.d/git-http-pcf.conf /etc/httpd/conf.d/git-http-pcf.conf +ADD etc/httpd/conf.d/git-http-apcf.conf /etc/httpd/conf.d/git-http-apcf.conf + # Add helper scripts. COPY opt/ /opt RUN chmod +x /opt/* +# Prevent git-http-backend safe.directory errors. +RUN git config --system --add safe.directory /srv/git + # Entrypoint. COPY ./entrypoint.sh / RUN chmod +x /entrypoint.sh -- cgit v1.2.3-70-g09d2