aboutsummaryrefslogtreecommitdiff
path: root/cgit
diff options
context:
space:
mode:
Diffstat (limited to 'cgit')
-rw-r--r--cgit/40-fcgiwrap.sh10
-rw-r--r--cgit/Dockerfile23
-rw-r--r--cgit/cgitrc7
-rw-r--r--cgit/site.template22
4 files changed, 62 insertions, 0 deletions
diff --git a/cgit/40-fcgiwrap.sh b/cgit/40-fcgiwrap.sh
new file mode 100644
index 0000000..3f788af
--- /dev/null
+++ b/cgit/40-fcgiwrap.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -ex
+
+# start fastcgiwrap
+rm -f /run/fcgiwrap.socket
+nohup fcgiwrap -s unix:/run/fcgiwrap.socket &
+while ! [ -S /run/fcgiwrap.socket ]; do sleep .2; done
+chown nginx:www-data /run/fcgiwrap.socket
+#chmod g+rwx /run/fcgiwrap.socket
+#test -f nohup.out && rm -f ./nohup.out
diff --git a/cgit/Dockerfile b/cgit/Dockerfile
new file mode 100644
index 0000000..e89b8d3
--- /dev/null
+++ b/cgit/Dockerfile
@@ -0,0 +1,23 @@
+FROM nginx:1.29.7-alpine-slim
+ARG DOMAIN=localhost
+
+RUN set -x \
+ && apk add --no-cache cgit fcgiwrap envsubst
+
+RUN apk update && apk update
+
+COPY 40-fcgiwrap.sh /docker-entrypoint.d/
+RUN chmod +x /docker-entrypoint.d/40-fcgiwrap.sh
+
+COPY cgitrc /etc/
+
+COPY site.template /
+RUN sed "s/\$DOMAIN/$DOMAIN/g" /site.template > /etc/nginx/conf.d/default.conf
+RUN rm /site.template
+
+RUN addgroup nginx www-data
+
+#RUN sed -i -Ee 's/pid\s+.*;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf
+#RUN sed -i -Ee 's/error_log\s+.*;/error_log \/dev\/stdout;/' /etc/nginx/nginx.conf
+#
+#USER nginx
diff --git a/cgit/cgitrc b/cgit/cgitrc
new file mode 100644
index 0000000..ecd0083
--- /dev/null
+++ b/cgit/cgitrc
@@ -0,0 +1,7 @@
+# Needed to avoid duplicating URI in every href
+virtual-root=/
+
+scan-path=/var/lib/git/repositories
+project-list=/var/lib/git/projects.list
+#enable-index-links=1
+repo.ignore=1
diff --git a/cgit/site.template b/cgit/site.template
new file mode 100644
index 0000000..c1962d9
--- /dev/null
+++ b/cgit/site.template
@@ -0,0 +1,22 @@
+server {
+ server_name $DOMAIN;
+
+ listen [::]:80;
+ listen 80;
+
+ access_log /var/log/nginx/cgit-access.log;
+ error_log /var/log/nginx/cgit-error.log;
+
+ root /usr/share/webapps/cgit;
+ try_files $uri @cgit;
+
+ location @cgit {
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
+ fastcgi_pass unix:/run/fcgiwrap.socket;
+
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_param HTTP_HOST $server_name;
+ }
+}