commit 35b1f49d42ac004d2e81d96d6227a62ac58ecf3f parent 90e5b03f2c4acdb884fbacdceea3afe4434a5a00 Author: FIGBERT <figbert@figbert.com> Date: Sat, 13 Aug 2022 16:24:24 -0700 Require stagit-export-ok magic file Diffstat:
M | README.md | | | 4 | +++- |
M | stagit | | | 10 | ++++++++-- |
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md @@ -44,7 +44,9 @@ Generates and serves static HTML pages from a directory of git repositories with `stagit` and `nginx`. Requirements: -- directory mounted at `/git` with your repositories as subdirectories +- directory mounted at `/git` with your bare repositories as subdirectories + - repositories will only be included in the output if they contain the + magic file `stagit-export-ok`. - clone url prefix in the `GIT_BASE_URL` environment variable (example: `https://git.example.com`) - files mounted in the nginx folder (`/usr/share/nginx/html`) diff --git a/stagit b/stagit @@ -1,10 +1,15 @@ FROM nginx:alpine RUN apk --no-cache add -X https://dl-cdn.alpinelinux.org/alpine/edge/testing stagit EXPOSE 80 -ENTRYPOINT stagit-index /git/*/ > /usr/share/nginx/html/index.html && \ +ENTRYPOINT dirs="" && \ for dir in /git/*/; do \ r=$(basename "${dir}"); \ d=$(basename "${dir}" ".git"); \ + if ! test -f "/git/${r}/stagit-export-ok"; then \ + continue; \ + else \ + dirs="${dirs}${dir} "; \ + fi; \ echo "${d}"; \ mkdir -p "/usr/share/nginx/html/${d}"; \ cd "/usr/share/nginx/html/${d}" || continue; \ @@ -13,4 +18,5 @@ ENTRYPOINT stagit-index /git/*/ > /usr/share/nginx/html/index.html && \ ln -sf ../style.css style.css; \ ln -sf ../logo.png logo.png; \ ln -sf ../favicon.png favicon.png; \ - done && /docker-entrypoint.sh nginx -g 'daemon off;' + done && stagit-index ${dirs} > /usr/share/nginx/html/index.html && \ + /docker-entrypoint.sh nginx -g 'daemon off;'