summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authora73x <[email protected]>2024-08-25 10:04:00 +0100
committera73x <[email protected]>2024-08-25 10:04:00 +0100
commit911a7dc7296f76a5de0538b3c3536167a89195d8 (patch)
tree662014839ebed4077e066ed2b86b9e7a0c045185
parentd9ae1cb433a5fe66c3f64b15e5849d11a87d0c53 (diff)
add ui
-rw-r--r--.build.yaml18
-rw-r--r--Dockerfile10
-rw-r--r--Makefile10
-rw-r--r--cgit/cgitrc26
-rw-r--r--cgit/entrypoint.sh4
-rw-r--r--cgit/nginx.conf26
-rw-r--r--entrypoint.sh6
7 files changed, 96 insertions, 4 deletions
diff --git a/.build.yaml b/.build.yaml
new file mode 100644
index 0000000..3bc1b37
--- /dev/null
+++ b/.build.yaml
@@ -0,0 +1,18 @@
+image: archlinux
+packages:
+ - go
+ - docker
+ - base-devel
+sources:
+ - [email protected]/~a73x/git
+secrets:
+ - 3b150464-eb54-49dc-9285-066a5aac30b1
+ - 5d82a198-740f-4b63-ad9d-6d1b5154ee51
+tasks:
+ - docker: |
+ sudo systemctl start docker
+ sudo usermod -aG docker $(whoami)
+ cat ~/.docker_token | docker login -u a73xsh --password-stdin
+ - setup: |
+ cd git
+ make public
diff --git a/Dockerfile b/Dockerfile
index a66b59a..b8039db 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,16 @@
-# Use a base image with Git and OpenSSH installed
FROM alpine:latest
# Install necessary packages
-RUN apk add --no-cache git openssh bash
+RUN apk add --no-cache git openssh bash cgit nginx fcgiwrap spawn-fcgi
# Create a directory for the Git repositories
# RUN mkdir -p /git-server/repos
+COPY cgit/nginx.conf /etc/nginx/http.d/default.conf
+COPY cgit/cgitrc /etc/cgitrc
+
+EXPOSE 80
+
# Create a user for running the Git server with git-shell as the default shell
RUN addgroup -S git && adduser -S git -G git -s /bin/bash && echo "git:*" | chpasswd -e
@@ -17,7 +21,7 @@ RUN addgroup -S git && adduser -S git -G git -s /bin/bash && echo "git:*" | chpa
RUN mkdir -p /home/git/.ssh \
&& chmod 700 /home/git/.ssh \
&& chown -R git:git /home/git/.ssh \
- && chown -R git:git /home/git
+ && chown -R git:nginx /home/git
# Add your SSH public key and restrict to git-shell
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d49496a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+VERSION=0.0.1
+DOCKER_IMAGE=a73xsh/cgit:${VERSION}
+
+.PHONY: image
+image:
+ docker build . -t ${DOCKER_IMAGE}
+
+.PHONY: public
+public: image
+ docker push ${DOCKER_IMAGE}
diff --git a/cgit/cgitrc b/cgit/cgitrc
new file mode 100644
index 0000000..68daaa1
--- /dev/null
+++ b/cgit/cgitrc
@@ -0,0 +1,26 @@
+#
+# cgit config
+#
+
+css=/cgit.css
+logo=/cgit.png
+
+# Following lines work with the above Apache config
+#css=/cgit-css/cgit.css
+#logo=/cgit-css/cgit.png
+
+# Following lines work with the above Lighttpd config
+#css=/cgit/cgit.css
+#logo=/cgit/cgit.png
+
+# Allow http transport git clone
+#enable-http-clone=0
+
+
+# if you do not want that webcrawler (like google) index your site
+robots=noindex, nofollow
+
+# if cgit messes up links, use a virtual-root. For example, cgit.example.org/ has this value:
+virtual-root=/
+
+scan-path=/home/git/
diff --git a/cgit/entrypoint.sh b/cgit/entrypoint.sh
new file mode 100644
index 0000000..7981264
--- /dev/null
+++ b/cgit/entrypoint.sh
@@ -0,0 +1,4 @@
+spawn-fcgi -s /run/fcgiwrap/fcgiwrap.socket -f /usr/bin/fcgiwrap
+chown nginx:nginx /run/fcgiwrap/fcgiwrap.socket
+
+exec nginx -g "daemon off;"
diff --git a/cgit/nginx.conf b/cgit/nginx.conf
new file mode 100644
index 0000000..592f2a0
--- /dev/null
+++ b/cgit/nginx.conf
@@ -0,0 +1,26 @@
+ server {
+ listen 80;
+ # server_name git.example.com;
+ root /usr/share/webapps/cgit;
+ try_files $uri @cgit;
+
+ # Configure HTTP transport
+ location ~ /.+/(info/refs|git-upload-pack) {
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param GIT_HTTP_EXPORT_ALL 1;
+ fastcgi_param GIT_PROJECT_ROOT /home/git;
+ fastcgi_param HOME /home/git;
+ fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.socket;
+ }
+
+ location @cgit {
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_param HTTP_HOST $server_name;
+ fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.socket;
+ }
+ }
diff --git a/entrypoint.sh b/entrypoint.sh
index 5a4bd74..95d2bad 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -7,7 +7,11 @@ if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
fi
+spawn-fcgi -s /run/fcgiwrap/fcgiwrap.socket -f /usr/bin/fcgiwrap
+chown nginx:nginx /run/fcgiwrap/fcgiwrap.socket
+
+nginx -g "daemon off;" &
# Start the SSH daemon
-/usr/sbin/sshd -D -e 2>&1
+/usr/sbin/sshd -D -e 2>&1