diff options
| author | saturneric <[email protected]> | 2025-11-02 11:43:20 +0000 |
|---|---|---|
| committer | saturneric <[email protected]> | 2025-11-02 11:43:20 +0000 |
| commit | 0d1f69a2c12cfc204a8abbc53897e22be70121d6 (patch) | |
| tree | 3aa2105ab28a2804c5add5b8ed70ef91ad838e5e | |
| parent | chore(gitignore): add `repos` to ignore list (diff) | |
| download | cgit-0d1f69a2c12cfc204a8abbc53897e22be70121d6.tar.gz cgit-0d1f69a2c12cfc204a8abbc53897e22be70121d6.zip | |
feat(docker): add `docker-compose` and improve config
* Introduce `docker-compose` for easier service orchestration
* Simplify and fix `lighttpd` config for cleaner routing and proxy
* Add `libcurl` dependency and cache setup for better compatibility
* Improve container volume mounts and permissions for smoother usage
| -rw-r--r-- | Dockerfile | 5 | ||||
| -rw-r--r-- | docker-compose.yaml | 13 | ||||
| -rw-r--r-- | lighttpd.conf | 35 |
3 files changed, 31 insertions, 22 deletions
@@ -8,7 +8,7 @@ RUN apk --no-cache add git && \ git submodule update --init --recursive RUN apk --no-cache add libc-dev git gcc make \ - openssl-dev libzip lua5.4-dev zlib-dev \ + openssl-dev libzip lua5.4-dev zlib-dev libcurl \ musl-libintl gettext-static RUN make NO_REGEX=NeedsStartEnd LUA_PKGCONFIG=lua5.4 -j$(nproc) install @@ -24,4 +24,7 @@ COPY lighttpd.conf /etc/lighttpd/lighttpd.conf COPY cgitrc /etc/cgitrc COPY cgitrepos /etc/cgitrepos +RUN mkdir -p /var/cache/cgit && \ + chown -R lighttpd:lighttpd /var/cache/cgit + ENTRYPOINT [ "lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf" ]
\ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..7767331 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +version: '3' + +services: + cgit: + build: . + ports: + - "8080:80" + volumes: + - ./cgit:/usr/share/webapps/cgit/cgit.cgi + - ./repos:/home/git/repositories + - ./lighttpd.conf:/etc/lighttpd/lighttpd.conf:ro + - ./cgitrc:/etc/cgitrc:ro + - ./cgitrepos:/etc/cgitrepos:ro
\ No newline at end of file diff --git a/lighttpd.conf b/lighttpd.conf index 99bdca7..dadabeb 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -1,27 +1,20 @@ -server.modules += ( "mod_cgi", "mod_rewrite", "mod_alias", "mod_proxy", "mod_access" ) +server.port = 80 +server.document-root = "/usr/share/webapps/cgit" +index-file.names = ( "cgit.cgi" ) +server.modules += ( "mod_access", "mod_alias", "mod_cgi", "mod_rewrite", "mod_proxy" ) +cgi.assign = ( ".cgi" => "" ) +mimetype.assign = ( ".css" => "text/css" ) + +# reserve proxy for gitea git service $HTTP["url"] =~ "^/(.+?)\.git/(info/refs|git-upload-pack)$" { $HTTP["request-method"] !~ "^(GET|POST)$" { - url.access-deny = ("") + url.access-deny = ( "" ) } - - proxy.server = ( - "" => (( - "host" => "gitea", - "port" => 3000, - )) - ) + proxy.server = ( "" => ( ( "host" => "localhost", "port" => 3000 ) ) ) } -else $HTTP["url"] =~ "^/" { - server.document-root = "/usr/share/webapps/cgit/" - server.indexfiles = ("cgit.cgi") - - cgi.assign = ("cgit.cgi" => "") - mimetype.assign = ( ".css" => "text/css" ) - # Rewrite any other url but the asset urls to be handled by the cgit - # executable. Use with virtual-root=/ cgitrc setting. - url.rewrite-once = ( - "^/((?!cgit\.(css|png)$)(?!favicon\.ico$)(?!robots\.txt$).*)$" => "/cgit.cgi/$1" - ) -}
\ No newline at end of file +# rewrite all requests to cgit.cgi except for static files +url.rewrite-once = ( + "^/((?!cgit\.(css|png)$)(?!favicon\.ico$)(?!robots\.txt$).*)$" => "/cgit.cgi/$1" +)
\ No newline at end of file |
