From 7479ca130fbb361aa76af2c1fa83c50d61b99408 Mon Sep 17 00:00:00 2001 From: Rikki Date: Sun, 13 Apr 2025 21:22:17 +0800 Subject: init --- Dockerfile | 17 +++++++++++++++++ cgitrc | 8 ++++++++ nginx.conf | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Dockerfile create mode 100644 cgitrc create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6ea85aa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM alpine:latest + +RUN apk add --no-cache \ + nginx \ + spawn-fcgi \ + fcgiwrap \ + git \ + cgit + +RUN mkdir -p /run/nginx && mkdir -p /var/www/git && \ + chown -R nginx:nginx /var/www/git + +COPY cgitrc /etc/cgitrc +COPY nginx.conf /etc/nginx/nginx.conf + +CMD spawn-fcgi -s /var/run/fcgiwrap.sock -U nginx -G nginx /usr/bin/fcgiwrap && \ + nginx -g "daemon off;" diff --git a/cgitrc b/cgitrc new file mode 100644 index 0000000..16b56bd --- /dev/null +++ b/cgitrc @@ -0,0 +1,8 @@ +virtual-root=/ +scan-path=/var/www/git + +enable-index-links=1 +enable-log-filecount=1 +enable-commit-graph=1 + +enable-index-owner=0 \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..482d19c --- /dev/null +++ b/nginx.conf @@ -0,0 +1,41 @@ +worker_processes 1; +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + + server { + listen 80; + server_name localhost; + + location / { + fastcgi_pass unix:/var/run/fcgiwrap.sock; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param GIT_PROJECT_ROOT /var/www/git; + fastcgi_param CGIT_CONFIG /etc/cgitrc; + } + + location /cgit.css { + alias /usr/share/webapps/cgit/cgit.css; + } + + location /cgit.png { + alias /usr/share/webapps/cgit/cgit.png; + } + + location /favicon.ico { + alias /usr/share/webapps/cgit/favicon.ico; + } + + location /robots.txt { + alias /usr/share/webapps/cgit/robots.txt; + } + } +} -- cgit v1.2.3