aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docker/cgitize.sh
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-30 12:17:39 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-30 12:17:39 +0200
commit934bc9a2857865b726dab0f63a9e7a2f6048ba50 (patch)
tree2faa023c894b68ae8e9c264ea5962ce5d3083d3c /docker/cgitize.sh
parentdocker: fix warnings in run_cron.sh (diff)
downloadcgitize-934bc9a2857865b726dab0f63a9e7a2f6048ba50.tar.gz
cgitize-934bc9a2857865b726dab0f63a9e7a2f6048ba50.zip
docker: rename scriptsv4.0.11
Diffstat (limited to 'docker/cgitize.sh')
-rwxr-xr-xdocker/cgitize.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/docker/cgitize.sh b/docker/cgitize.sh
new file mode 100755
index 0000000..92fe43c
--- /dev/null
+++ b/docker/cgitize.sh
@@ -0,0 +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 "$@"
+}
+
+main "$@"