From 99f83042ad2ebf51c03a17480945241b35252f7e Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 14 Oct 2026 16:06:30 +0500 Subject: docker: cgitize.sh -> run.sh --- docker/Dockerfile | 4 ++-- docker/cgitize.sh | 47 ----------------------------------------------- docker/run.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 49 deletions(-) delete mode 100755 docker/cgitize.sh create mode 100755 docker/run.sh diff --git a/docker/Dockerfile b/docker/Dockerfile index aeba7ce..e4fc209 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,7 +37,7 @@ ENV PYTHONPATH="/deps:/usr/src" ENV SSH_AUTH_SOCK="/ssh/agent.sock" -COPY ["docker/cgitize.sh", "/"] +COPY ["docker/run.sh", "/"] COPY ["docker/get_output_dir.py", "/"] COPY ["docker/in_cron.sh", "/"] COPY ["cgitize/", "/usr/src/cgitize/"] @@ -46,6 +46,6 @@ ENV SCHEDULE_ON_START=1 ENTRYPOINT ["/sbin/tini", "--", "/in_cron.sh"] WORKDIR /usr/src -CMD ["/cgitize.sh"] +CMD ["/run.sh"] HEALTHCHECK --interval=5m --retries=3 CMD ! test -f /fail diff --git a/docker/cgitize.sh b/docker/cgitize.sh deleted file mode 100755 index 96118d5..0000000 --- a/docker/cgitize.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2023 Egor Tensin -# This file is part of the "cgitize" project. -# For details, see https://github.com/egor-tensin/cgitize -# Distributed under the MIT License. - -set -o errexit -o nounset -o pipefail -shopt -s inherit_errexit lastpipe - -script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" -script_dir="$( cd -- "$script_dir" && pwd )" -readonly script_dir - -readonly src_dir=/usr/src -readonly cfg_path=/etc/cgitize/cgitize.toml -readonly fail_path=/fail - -secure_repo_dir() { - local dir - dir="$( "$script_dir/get_output_dir.py" -- "$cfg_path" )" - - chmod -- o-rwx "$dir" - - # This is required so that nginx can access the directory. - # nginx uses a fixed UID: - # https://github.com/nginxinc/docker-nginx/blob/4785a604aa40e0b0a69047a61e28781a2b0c2069/mainline/alpine-slim/Dockerfile#L16 - chown -- :101 "$dir" -} - -setup() { - secure_repo_dir - touch -- "$fail_path" -} - -run() { - cd -- "$src_dir" - python3 -m cgitize.main "$@" - rm -f -- "$fail_path" -} - -main() { - setup - run "$@" -} - -main "$@" diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 0000000..96118d5 --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Copyright (c) 2023 Egor Tensin +# This file is part of the "cgitize" project. +# For details, see https://github.com/egor-tensin/cgitize +# Distributed under the MIT License. + +set -o errexit -o nounset -o pipefail +shopt -s inherit_errexit lastpipe + +script_dir="$( dirname -- "${BASH_SOURCE[0]}" )" +script_dir="$( cd -- "$script_dir" && pwd )" +readonly script_dir + +readonly src_dir=/usr/src +readonly cfg_path=/etc/cgitize/cgitize.toml +readonly fail_path=/fail + +secure_repo_dir() { + local dir + dir="$( "$script_dir/get_output_dir.py" -- "$cfg_path" )" + + chmod -- o-rwx "$dir" + + # This is required so that nginx can access the directory. + # nginx uses a fixed UID: + # https://github.com/nginxinc/docker-nginx/blob/4785a604aa40e0b0a69047a61e28781a2b0c2069/mainline/alpine-slim/Dockerfile#L16 + chown -- :101 "$dir" +} + +setup() { + secure_repo_dir + touch -- "$fail_path" +} + +run() { + cd -- "$src_dir" + python3 -m cgitize.main "$@" + rm -f -- "$fail_path" +} + +main() { + setup + run "$@" +} + +main "$@" -- cgit v1.3