diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 53 |
1 files changed, 42 insertions, 11 deletions
@@ -1,25 +1,56 @@ # cgit-docker +cgit Docker container. +Scans for repos at `/srv/git`. -### About -cgit is a CGI web interface for git scm developed by the guy who created wireguard. You can read more on the cgit project [here](https://git.zx2c4.com/cgit/about). - -There's no official docker container for cgit. However, this will you to easily deploy it. +## Running the Container +```bash +docker pull ratdad/cgit +docker run --name cgit -d -p 80:80 -v git/repo/location:/srv/git +``` -### Installation -You can use Docker Compose to create an instance of the server. +You can optionally run with HTTP Basic Auth with these options. +```bash +docker run --name cgit -d -p 80:80 -v git/repo/location:/srv/git -e HTTP_AUTH_PASSWORD=pass HTTP_AUTH_USER=user +``` +## Docker Compose +You can use Docker Compose to create an instance of the server. ```yaml +# +# +# cgit-docker compose example + name: 'cgit-docker' services: cgit: container_name: cgit-docker - image: ratdad/cgit-docker:latest + build: + context: . + dockerfile: Dockerfile + # You can also use the pre-built containers hosted at ghcr and docker + # image: ghcr.io/bigratdad/cgit-docker:latest + # image: ratdad/cgit-docker:latest + env_file: + - .env ports: - 80:80 volumes: - - ./etc/httpd/conf/httpd.conf:/etc/httpd/conf/httpd.conf # apply custom httpd config - - ./etc/cgitrc:/etc/cgitrc # apply custom cgit runtime config - - ./opt/highlight.sh:/opt/highlight.sh # use a custom highlight script - - ./srv/git/:/srv/git # mount the dir cgit reads for repositories + - ./etc/httpd/conf/httpd.conf:/etc/httpd/conf/httpd.conf # you may want to change the httpd config on the server + - ./etc/cgitrc:/etc/cgitrc # you can (and should) bind your own cgitrc + - ./opt/:/opt # put your helper scripts in /opt + - ./srv/git/:/srv/git # bind the location of your git repos to /srv/git in the container ``` + +## Configuration +There are several areas you may want to configure on this server. + +### Runtime Configuration +Runtime configuration is done via a `cgitrc` file placed in `/etc/cgitrc` on the container. If you're using a compose file, you should be able to bind your own `cgitrc` file to that location. See [cgitrc(5)](https://linux.die.net/man/5/cgitrc) for more details on how to write this file for your specific use case. + +### Apache Web Server +This container runs Apache Web Server. I made this decision because it's one of the few http servers that has built support for Common Gateway Interface. + +**To configure**, just mount your custom `httpd.conf` to `/etc/httpd/conf/httpd.conf` inside the container. Just keep in mind that cgit is compiled to serve its files in `/srv/www/htdocs/cgit/` and not the default location of `/var/www/htdocs/cgit/` as the documentation states. This is a decision I made deliberately because `/srv/` is where server files should go. + + |
