Initial commit

main
Jerry Aldrich 6 years ago
commit 6969795881
  1. 2
      .gitignore
  2. 27
      Dockerfile
  3. 1
      README.md
  4. 71
      cgitrc.template
  5. 17
      entrypoint.sh
  6. 38
      nginx.conf

2
.gitignore vendored

@ -0,0 +1,2 @@
keys/*
repos/*

@ -0,0 +1,27 @@
FROM nginx:alpine
LABEL maintainer "jerryaldrichiii@gmail.com"
VOLUME ["/srv/git/repos"]
RUN apk add --no-cache git fcgiwrap spawn-fcgi highlight py3-markdown py3-docutils py3-pygments
# nginx:alpine = Alpine 3.11
RUN apk add --no-cache cgit=1.2.1-r1
COPY nginx.conf /etc/nginx/nginx.conf
# Create group so data can be shared/accessed
RUN addgroup --gid 1000 shared
RUN adduser nginx shared
EXPOSE 8080
COPY cgitrc.template /etc/
RUN touch /etc/cgitrc && chown nginx:nginx /etc/cgitrc
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
USER nginx
ENTRYPOINT ["/entrypoint.sh"]

@ -0,0 +1 @@
# cgit

@ -0,0 +1,71 @@
root-title=$CGIT_TITLE
root-desc=$CGIT_DESC
virtual-root=$CGIT_VROOT
section-from-path=$CGIT_SECTION_FROM_STARTPATH
remove-suffix=1
##
## Search for these files in the root of the default branch of repositories
## for coming up with the about page:
##
readme=:README.md
readme=:readme.md
readme=:README.mkd
readme=:readme.mkd
readme=:README.rst
readme=:readme.rst
readme=:README.html
readme=:readme.html
readme=:README.htm
readme=:readme.htm
readme=:README.txt
readme=:readme.txt
readme=:README
readme=:readme
readme=:INSTALL.md
readme=:install.md
readme=:INSTALL.mkd
readme=:install.mkd
readme=:INSTALL.rst
readme=:install.rst
readme=:INSTALL.html
readme=:install.html
readme=:INSTALL.htm
readme=:install.htm
readme=:INSTALL.txt
readme=:install.txt
readme=:INSTALL
readme=:install
mimetype.gif=image/gif
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
# Cache
cache-root=/var/cache/cgit
cache-size=1000
enable-index-links=1
enable-index-owner=0
enable-remote-branches=1
enable-log-filecount=1
enable-log-linecount=1
enable-git-config=1
snapshots=tar.gz tar.bz2 zip
robots=noindex, nofollow
source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh
clone-url=git://$CGIT_FQDN/$CGIT_REPO_URL
enable-commit-graph=1
# This needs to be at the bottom
# https://linux.die.net/man/5/cgitrc
# > Be advised that only the global settings taken before the scan-path
# > directive will be applied to each repository.
scan-path=/srv/git/repos

@ -0,0 +1,17 @@
#!/bin/sh
set -e
export CGIT_TITLE=${CGIT_TITLE:="TEST TITLE - CHANGE ME"}
export CGIT_DESC=${CGIT_DESC:="TEST DESC"}
export CGIT_VROOT=${CGIT_VROOT:="/"}
export CGIT_FQDN=${CGIT_FQDN:="git.changeme.com"}
export CGIT_SECTION_FROM_STARTPATH=${CGIT_SECTION_FROM_STARTPATH:=1}
CGIT_VARS='$CGIT_TITLE:$CGIT_DESC:$CGIT_VROOT:$CGIT_SECTION_FROM_STARTPATH'
envsubst "$CGIT_VARS" < /etc/cgitrc.template > /etc/cgitrc
/usr/bin/spawn-fcgi -s /tmp/fcgiwrap.socket /usr/bin/fcgiwrap
/usr/sbin/nginx -g "daemon off;"

@ -0,0 +1,38 @@
worker_processes 1;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
# Cgit
server {
listen 8080;
server_name git.*;
root /usr/share/webapps/cgit;
try_files $uri @cgit;
location @cgit {
include fastcgi_params;
# TODO: move fcgiwrap.sock out of /tmp
fastcgi_pass unix:/tmp/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param QUERY_STRING $args;
fastcgi_param HTTP_HOST $server_name;
}
}
}
Loading…
Cancel
Save