Sophia

Sophia / Simple git http server

Last active 1 week ago

Sophia revised this gist 1 week ago · 5d02624

3 files changed, 57 insertions

Containerfile (file created)
@@ -0,0 +1,13 @@
1 + # Located in app directory
2 + FROM docker.io/nginx:stable-alpine
3 +
4 + RUN apk add --no-cache git-daemon fcgiwrap spawn-fcgi
5 +
6 + COPY nginx.conf /etc/nginx/nginx.conf
7 +
8 + VOLUME ["/git"]
9 +
10 + EXPOSE 80
11 +
12 + CMD spawn-fcgi -s /run/fcgi.sock /usr/bin/fcgiwrap && \
13 + nginx -g "daemon off;"
compose.yaml (file created)
@@ -0,0 +1,14 @@
1 + # labels and networks are fairly specific to my Podman setup, so adjust as necessary
2 + services:
3 + git-http-server:
4 + build: ./app
5 + volumes:
6 + - ~/repos:/git
7 + labels:
8 + caddy: server.example.com
9 + caddy.import: defaults
10 + caddy.reverse_proxy: "{{upstreams 80}}"
11 +
12 + networks:
13 + services:
14 + external: true
nginx.conf (file created)
@@ -0,0 +1,30 @@
1 + # Located in app directory
2 + user root;
3 + worker_processes 1;
4 +
5 + error_log /var/log/nginx/error.log warn;
6 + pid /var/run/nginx.pid;
7 +
8 + events {
9 + worker_connections 1024;
10 + }
11 +
12 + http {
13 + server {
14 + listen *:80;
15 +
16 + access_log /var/log/nginx/access.log;
17 +
18 + location ~ (/.*) {
19 + # Set chunks to unlimited, as the bodies can be huge
20 + client_max_body_size 0;
21 +
22 + include fastcgi_params;
23 + fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
24 + fastcgi_param GIT_PROJECT_ROOT /git;
25 + fastcgi_param PATH_INFO $1;
26 +
27 + fastcgi_pass unix:/run/fcgi.sock;
28 + }
29 + }
30 + }