aboutsummaryrefslogtreecommitdiff
path: root/infra/containers/cgit
diff options
context:
space:
mode:
Diffstat (limited to 'infra/containers/cgit')
-rw-r--r--infra/containers/cgit/.containerignore21
-rw-r--r--infra/containers/cgit/Containerfile27
-rw-r--r--infra/containers/cgit/cgitrc27
-rw-r--r--infra/containers/cgit/cgitrc.local27
-rw-r--r--infra/containers/cgit/entrypoint.sh20
-rw-r--r--infra/containers/cgit/nginx.conf46
-rw-r--r--infra/containers/cgit/supervisord.conf42
7 files changed, 210 insertions, 0 deletions
diff --git a/infra/containers/cgit/.containerignore b/infra/containers/cgit/.containerignore
new file mode 100644
index 0000000..4fb13e4
--- /dev/null
+++ b/infra/containers/cgit/.containerignore
@@ -0,0 +1,21 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+*
+!Containerfile
+!entrypoint.sh
+!nginx.conf
+!supervisord.conf
+!cgitrc
diff --git a/infra/containers/cgit/Containerfile b/infra/containers/cgit/Containerfile
new file mode 100644
index 0000000..3bd130a
--- /dev/null
+++ b/infra/containers/cgit/Containerfile
@@ -0,0 +1,27 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+FROM docker.io/library/debian:trixie-slim@sha256:1e1a22175fbf1b32157ddaf0219e1db4e5401fab2b94ed285add64d18587cd2d
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ cgit fcgiwrap nginx-light supervisor curl ca-certificates git \
+ && rm -rf /var/lib/apt/lists/* /etc/nginx/sites-enabled/default
+COPY nginx.conf /etc/nginx/nginx.conf
+COPY supervisord.conf /etc/supervisor/stack.conf
+COPY cgitrc /etc/cgitrc
+COPY entrypoint.sh /usr/local/bin/stack-cgit
+RUN chmod 755 /usr/local/bin/stack-cgit
+EXPOSE 8080
+ENTRYPOINT ["/usr/local/bin/stack-cgit"]
diff --git a/infra/containers/cgit/cgitrc b/infra/containers/cgit/cgitrc
new file mode 100644
index 0000000..0b563e0
--- /dev/null
+++ b/infra/containers/cgit/cgitrc
@@ -0,0 +1,27 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+root-title=Doan Luu Duc Tai's repositories
+root-desc=Personal git repos
+virtual-root=/
+clone-prefix=https://git.doan.luuduct.ai
+css=/cgit.css
+favicon=/favicon.ico
+remove-suffix=1
+defbranch=main
+cache-root=/var/cache/cgit
+cache-size=1000
+cache-scanrc-ttl=1
+scan-path=/srv/git
diff --git a/infra/containers/cgit/cgitrc.local b/infra/containers/cgit/cgitrc.local
new file mode 100644
index 0000000..3c8d657
--- /dev/null
+++ b/infra/containers/cgit/cgitrc.local
@@ -0,0 +1,27 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+root-title=Doan Luu Duc Tai's repositories (local)
+root-desc=Restored local copy
+virtual-root=/git/
+clone-prefix=http://localhost:8080/git
+css=/git/cgit.css
+favicon=/git/favicon.ico
+remove-suffix=1
+defbranch=main
+cache-root=/var/cache/cgit
+cache-size=1000
+cache-scanrc-ttl=1
+scan-path=/srv/git
diff --git a/infra/containers/cgit/entrypoint.sh b/infra/containers/cgit/entrypoint.sh
new file mode 100644
index 0000000..5de3a06
--- /dev/null
+++ b/infra/containers/cgit/entrypoint.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+set -eu
+mkdir -p /run/fcgiwrap /var/cache/cgit
+chown www-data:www-data /run/fcgiwrap /var/cache/cgit
+exec /usr/bin/supervisord -n -c /etc/supervisor/stack.conf
diff --git a/infra/containers/cgit/nginx.conf b/infra/containers/cgit/nginx.conf
new file mode 100644
index 0000000..df50345
--- /dev/null
+++ b/infra/containers/cgit/nginx.conf
@@ -0,0 +1,46 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+user www-data;
+worker_processes auto;
+pid /run/nginx.pid;
+error_log /dev/stderr warn;
+events { worker_connections 1024; }
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+ access_log /dev/stdout;
+ map $http_x_forwarded_proto $cgi_https {
+ default "";
+ https on;
+ }
+ server {
+ listen 8080;
+ server_name _;
+ root /usr/share/cgit;
+ location ~* ^/(cgit\.(css|png|js)|favicon\.ico|robots\.txt)$ {
+ expires 30d;
+ }
+ location / {
+ include /etc/nginx/fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_param HTTP_HOST $http_host;
+ fastcgi_param HTTPS $cgi_https;
+ fastcgi_pass unix:/run/fcgiwrap/socket;
+ }
+ }
+}
diff --git a/infra/containers/cgit/supervisord.conf b/infra/containers/cgit/supervisord.conf
new file mode 100644
index 0000000..1a93bb5
--- /dev/null
+++ b/infra/containers/cgit/supervisord.conf
@@ -0,0 +1,42 @@
+# Copyright (C) 2026 Doan Luu Duc Tai <doan@luuduct.ai>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+[supervisord]
+nodaemon=true
+user=root
+logfile=/dev/null
+pidfile=/run/supervisord.pid
+
+[program:fcgiwrap]
+command=/usr/sbin/fcgiwrap -f -s unix:/run/fcgiwrap/socket
+user=www-data
+umask=0007
+autorestart=true
+stopasgroup=true
+killasgroup=true
+stdout_logfile=/dev/fd/1
+stdout_logfile_maxbytes=0
+stderr_logfile=/dev/fd/2
+stderr_logfile_maxbytes=0
+
+[program:nginx]
+command=/usr/sbin/nginx -g "daemon off;"
+autorestart=true
+stopasgroup=true
+killasgroup=true
+stdout_logfile=/dev/fd/1
+stdout_logfile_maxbytes=0
+stderr_logfile=/dev/fd/2
+stderr_logfile_maxbytes=0