summaryrefslogtreecommitdiff
path: root/docker/entrypoint.sh
diff options
context:
space:
mode:
authorhaturatu <taro@eyes4you.org>2026-04-21 05:21:33 +0900
committerhaturatu <taro@eyes4you.org>2026-04-21 05:21:33 +0900
commit836cdbbcb566a36c16b28305b50a502fa09f2c97 (patch)
tree796904fec1e2536e83630be181d9f3777bd2de3e /docker/entrypoint.sh
first commitHEADmain
Diffstat (limited to 'docker/entrypoint.sh')
-rw-r--r--docker/entrypoint.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
new file mode 100644
index 0000000..c3ccc41
--- /dev/null
+++ b/docker/entrypoint.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+set -eu
+
+if [ ! -d /var/lib/git/repos ]; then
+ echo "repository path /var/lib/git/repos does not exist" >&2
+ exit 1
+fi
+
+mkdir -p /run/fcgiwrap
+chown www-data:www-data /run/fcgiwrap
+
+if [ -n "${CGIT_TITLE:-}" ]; then
+ sed -i "s/^root-title=.*/root-title=${CGIT_TITLE}/" /etc/cgitrc
+fi
+
+if [ -n "${CGIT_DESC:-}" ]; then
+ sed -i "s/^root-desc=.*/root-desc=${CGIT_DESC}/" /etc/cgitrc
+fi
+
+if [ -n "${CGIT_CLONE_BASE_URL:-}" ]; then
+ sed -i "s#^clone-url=.*#clone-url=${CGIT_CLONE_BASE_URL}/\\\$CGIT_REPO_URL#" /etc/cgitrc
+fi
+
+spawn-fcgi -s /run/fcgiwrap/fcgiwrap.sock -U www-data -G www-data -- /usr/sbin/fcgiwrap
+
+exec nginx -g "daemon off;"