File tree 5 files changed +150
-0
lines changed
5 files changed +150
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ # Script to start a fcgiwrap socket. Loaded during Docker entrypoint.
3
+ SOCKET_PATH=/run/fcgiwrap/fcgiwrap.sock
4
+
5
+ echo " Starting fcgiwrap..."
6
+ if [ -e " $SOCKET_PATH " ]; then
7
+ echo " Removing previous socket: $SOCKET_PATH "
8
+ rm $SOCKET_PATH
9
+ fi
10
+
11
+ echo " Waiting for fcgiwrap to create a socket..."
12
+ /usr/bin/fcgiwrap -s unix:$SOCKET_PATH &
13
+ while [ ! -e " $SOCKET_PATH " ]; do
14
+ sleep 2
15
+ done
16
+ chmod 766 $SOCKET_PATH
17
+
18
+ exit 0;
Original file line number Diff line number Diff line change
1
+ # Image to build cgit
2
+ FROM alpine:latest AS build
3
+
4
+ ARG CGIT_REPO_URL=https://git.zx2c4.com/cgit
5
+
6
+ # To avoid conflict: undeclared REG_STARTEND compiling git with musl
7
+ # https://github.com/git/git/blob/23b219f8e3f2adfb0441e135f0a880e6124f766c/git-compat-util.h#L1279-L1281
8
+ ENV NO_REGEX=NeedsStartEnd
9
+
10
+ RUN apk add --no-cache \
11
+ git \
12
+ make \
13
+ gcc \
14
+ musl-dev \
15
+ musl-libintl \
16
+ openssl-dev \
17
+ zlib-dev \
18
+ luajit
19
+
20
+ RUN git clone --depth 1 $CGIT_REPO_URL /opt/cgit-repo
21
+ WORKDIR /opt/cgit-repo
22
+ COPY ["cgit_build.conf" , "/opt/cgit-repo/cgit.conf" ]
23
+ RUN git submodule init && git submodule update
24
+ RUN make && make install
25
+
26
+
27
+ # Image to run cgit with NGINX and fcgiwrap
28
+ FROM nginx:alpine
29
+
30
+ ARG CGIT_CACHE_PATH=/opt/cgit/cache
31
+
32
+ RUN apk add --no-cache \
33
+ fcgiwrap \
34
+ git \
35
+ groff \
36
+ python3 \
37
+ py3-pip \
38
+ py3-pygments \
39
+ py3-markdown \
40
+ luajit \
41
+ && ln -sf python3 /usr/bin/python \
42
+ && python -m pip install rst2html
43
+
44
+ # Nginx cgit config
45
+ COPY ["cgit_nginx.conf" , "/etc/nginx/conf.d/default.conf" ]
46
+
47
+ # Cgit setup
48
+ COPY --from=build /opt/cgit /opt/cgit
49
+ COPY ["cgitrc" , "/opt/cgit/" ]
50
+ COPY ["./filters/html-converters/rst2html" , "/opt/cgit/filters/html-converters/" ]
51
+ RUN mkdir -p $CGIT_CACHE_PATH
52
+
53
+ COPY ["40-fcgiwrap.sh" , "/docker-entrypoint.d/" ]
54
+ VOLUME ["/opt/git" ]
55
+ EXPOSE 80
Original file line number Diff line number Diff line change
1
+ CGIT_SCRIPT_PATH = /opt/cgit/app
2
+ CGIT_CONFIG = /opt/cgit/cgitrc
3
+ CACHE_ROOT = /opt/cgit/cache
4
+ prefix = /opt/cgit
5
+ libdir = $(prefix)
6
+ filterdir = $(libdir)/filters
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80;
3
+ listen [::]:80;
4
+ server_name localhost;
5
+
6
+ root /opt/cgit/app;
7
+ try_files $uri @cgit;
8
+
9
+ access_log /var/log/nginx/cgit-access.log;
10
+ error_log /var/log/nginx/cgit-error.log;
11
+
12
+ # Serve static files
13
+ location ~* \.(css|png|ico)$ {
14
+ root /opt/cgit/app;
15
+ expires 30d;
16
+ }
17
+
18
+ location @cgit {
19
+ include fastcgi_params;
20
+ fastcgi_param SCRIPT_FILENAME /opt/cgit/app/cgit.cgi;
21
+ fastcgi_param PATH_INFO $uri;
22
+ fastcgi_param QUERY_STRING $args;
23
+ fastcgi_param HTTP_HOST $server_name;
24
+ fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.sock;
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ # cigit documentation: https://git.zx2c4.com/cgit/tree/cgitrc.5.txt
2
+ # General
3
+ root-title=Git Repository Browser
4
+ virtual-root=/
5
+ robots=noindex, nofollow
6
+ enable-commit-graph=1
7
+ enable-filter-overrides=1
8
+ enable-index-links=1
9
+ enable-log-filecount=1
10
+ enable-log-linecount=1
11
+ enable-subject-links=1
12
+ max-stats=year
13
+ noplainemail=1
14
+ enable-blame=1
15
+ enable-follow-links=1
16
+ enable-html-serving=1
17
+ enable-remote-branches=1
18
+ enable-index-owner=0
19
+ # Use pygments for syntax highlighting
20
+ source-filter=/opt/cgit/filters/syntax-highlighting.py
21
+ about-filter=/opt/cgit/filters/about-formatting.sh
22
+ commit-filter=/opt/cgit/filters/commit-links.sh
23
+ email-filter=/opt/cgit/filters/email-gravatar.py
24
+
25
+ # Cache
26
+ cache-size=40
27
+ cache-root=/opt/cgit/cache
28
+ cache-dynamic-ttl=10
29
+ cache-repo-ttl=10
30
+ cache-root-ttl=10
31
+ cache-scanrc-ttl=10
32
+ cache-static-ttl=10
33
+
34
+ # Repos
35
+ remove-suffix=1
36
+ enable-git-config=1
37
+ # requires python-markdown
38
+ readme=:README.md
39
+ # requires rst2html
40
+ readme=:README.rst
41
+ readme=:README.txt
42
+ readme=:README.html
43
+ scan-path=/opt/git/
44
+ # List of repositories can be included
45
+ #include=/opt/cgit/cgitrepos
You can’t perform that action at this time.
0 commit comments