Docker image for Cgit a web interface for Git repositories.
The image compiles and deploys Cgit with Nginx and fcgiwrap.
To run it:
docker compose up
And then open the URL localhost:8082
. If you want to customize the compilation, installation or configuration, edit the corresponding files.
- You can check and edit the Cgit configuration of the image in the
cgitrc
file. - The Nginx configuration is in the
cgit_nginx.conf
file. cgit_build.conf
contains environment variables for Cgit compilation. You need to edit it if you want to use different paths.
If you want to use your own settings you can mount your cgitrc
file as follows.
services:
cgit:
hostname: cgit
image: cgit:latest
build: .
ports:
- "8080:80"
restart: on-failure:5
volumes:
- type: bind
source: ./path/to/cgitrc
target: /opt/cgit/cgitrc
The Cgit scan-path
configuration parameter is set to read repositories from the /opt/git
path. That path can be mounted as a volume.
volumes:
- git-vlume:/opt/git/
This example show how to add basic auth (and allow push changes) to you cgit server.
# up example [docker-compose.auth-example.yml] configuration
docker compose -f docker-compose.auth-example.yml down -v && docker compose -f docker-compose.auth-example.yml up --build
# clone repo as root
docker compose -f docker-compose.auth-example.yml exec cgit git clone --bare https://github.com/nginx/nginx.git /opt/git/nginx.git
# setup permission to allow write by fcgiwrap process
docker compose -f docker-compose.auth-example.yml exec cgit chown -R nginx:nginx /opt/git/nginx.git
# clone repo (use: dev / 123), make some changes and push back
git clone http://localhost:8082/nginx /tmp/nginx-cloned
echo "CHANGED" >> /tmp/nginx-cloned/README.md
(cd /tmp/nginx-cloned && git add . && git commit -m 'changed' && git push)