diff options
| author | RATDAD <lambda@disroot.org> | 2025-12-13 21:00:08 -0500 |
|---|---|---|
| committer | RATDAD <lambda@disroot.org> | 2025-12-13 21:00:08 -0500 |
| commit | 00dffa8cf5cac8322cb47f2222e424d3960e7939 (patch) | |
| tree | 7db0460694037b063f97058ecb9eb664b6162b45 /Dockerfile | |
| parent | de8d06726cae205ead43f8b1ac07ecc59a07363b (diff) | |
| download | cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.tar.gz cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.tar.bz2 cgit-docker-00dffa8cf5cac8322cb47f2222e424d3960e7939.zip | |
Added Git Smart HTTP Support
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 61 |
1 files changed, 45 insertions, 16 deletions
@@ -1,35 +1,64 @@ # # -# cgit Docker Container - -FROM rockylinux:9 -LABEL MAINTAINER="RATDAD <lambda@disroot.org>" +# 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 <lambda@disroot.org>" -# 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 |
