diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-02-27 11:40:09 +0100 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-02-27 11:49:05 +0100 |
commit | 959c3990b8ef8e42337f7c450d82b0506d615a9a (patch) | |
tree | 75ff7825d533d82871312aa796b2215e601825f1 /docker/run.sh | |
parent | v4.0.8 (diff) | |
download | cgitize-959c3990b8ef8e42337f7c450d82b0506d615a9a.tar.gz cgitize-959c3990b8ef8e42337f7c450d82b0506d615a9a.zip |
docker: remove entrypoint.sh
The remainder functionality fits nicely to run.sh.
Diffstat (limited to '')
-rwxr-xr-x | docker/run.sh | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/docker/run.sh b/docker/run.sh index 6fb7ee3..92fe43c 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -1,6 +1,44 @@ #!/usr/bin/env bash +# Copyright (c) 2023 Egor Tensin <Egor.Tensin@gmail.com> +# 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 + +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 +} + +run() { + cd -- "$src_dir" + exec python3 -m cgitize.main "$@" +} + +main() { + setup + run "$@" +} -cd /usr/src -exec python3 -m cgitize.main "$@" +main "$@" |