diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-18 23:41:10 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-18 23:41:10 +0200 |
commit | b1fb9f526726ab3cd20029095d5ed9629ff73693 (patch) | |
tree | 1e28ef73d03eee180557a100ca0e31847f15bd3d | |
parent | 00f8fd8a71ad956dda0e90a42f947f1f805585dc (diff) |
-rw-r--r-- | docker-compose.yml | 9 | ||||
-rw-r--r-- | docker/cgit/Dockerfile | 2 | ||||
-rwxr-xr-x | docker/cgit/docker-entrypoint.sh | 17 |
3 files changed, 16 insertions, 12 deletions
diff --git a/docker-compose.yml b/docker-compose.yml index 28b327b..26abf4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,22 +8,15 @@ services: env_file: .env volumes: - "${REPOSITORIES_PATH}:${CGIT_SCAN_PATH}" + - "./data/assets:/usr/share/cgit-docker" networks: - traefik labels: - "traefik.enable=true" - - "traefik.http.routers.cgit.rule=Host(`${DOMAIN}`) && PathPrefix(`/cgit`)" - - "traefik.http.routers.cgit.entrypoints=websecure" - - "traefik.http.routers.cgit.tls=true" - - "traefik.http.routers.cgit.tls.certresolver=letsencrypt" - - "traefik.http.routers.cgit-root.rule=Host(`${DOMAIN}`)" - "traefik.http.routers.cgit-root.entrypoints=websecure" - "traefik.http.routers.cgit-root.tls=true" - "traefik.http.routers.cgit-root.tls.certresolver=letsencrypt" - - "traefik.http.middlewares.cgit-root.redirectregex.regex=${DOMAIN}/(.*)" - - "traefik.http.middlewares.cgit-root.redirectregex.replacement=${DOMAIN}/cgit/$${1}" - - "traefik.http.routers.cgit-root.middlewares=cgit-root" networks: traefik: diff --git a/docker/cgit/Dockerfile b/docker/cgit/Dockerfile index 187cf10..f98f715 100644 --- a/docker/cgit/Dockerfile +++ b/docker/cgit/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update RUN apt-get install -y \ cgit \ - python3 + python3 vim RUN : \ && a2enmod cgi diff --git a/docker/cgit/docker-entrypoint.sh b/docker/cgit/docker-entrypoint.sh index 102d46c..6d632c0 100755 --- a/docker/cgit/docker-entrypoint.sh +++ b/docker/cgit/docker-entrypoint.sh @@ -1,13 +1,24 @@ -#!/bin/sh +#!/bin/bash if [ "${1}" = "init" ]; then + # setup apache + sed -i "s/ScriptAlias \/cgit\//ScriptAlias \//" /etc/apache2/conf-enabled/cgit.conf + sed -i "/RedirectMatch/d" /etc/apache2/conf-enabled/cgit.conf + ex -s -c $(grep -n "^Alias" /etc/apache2/conf-enabled/cgit.conf | cut -d ":" -f 1)m0 -c w -c q /etc/apache2/conf-enabled/cgit.conf + sed -i "s/\/usr\/share\/cgit/\/usr\/share\/cgit-docker/" /etc/apache2/conf-enabled/cgit.conf + service apache2 start - /docker-init.py + # populate assets + if [ ! $(ls -A /usr/share/cgit-docker) ]; then + cp /usr/share/cgit/* /usr/share/cgit-docker/ + fi - # TODO: https://git-scm.com/docs/gitweb#_generating_projects_list_using_gitweb + # run complex init + /docker-init.py + # loop tail -f /dev/null else exec "$@" |