aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docker/Dockerfile3
-rwxr-xr-xdocker/entrypoint.sh40
-rwxr-xr-xdocker/run.sh42
3 files changed, 41 insertions, 44 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index f745ca6..2f14976 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -20,14 +20,13 @@ ARG ssh_sock_dir=/
ARG ssh_sock_path="$ssh_sock_dir/ssh-agent.sock"
ENV SSH_AUTH_SOCK "$ssh_sock_path"
-COPY ["docker/entrypoint.sh", "/"]
COPY ["docker/get_output_dir.py", "/"]
COPY ["docker/run.sh", "/"]
COPY ["docker/run_cron.sh", "/"]
COPY ["cgitize/", "/usr/src/cgitize/"]
ENV SCHEDULE_ON_START=1
-ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
+ENTRYPOINT ["/sbin/tini", "--", "/run_cron.sh"]
WORKDIR /usr/src
CMD ["/run.sh"]
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
deleted file mode 100755
index 35ef3e3..0000000
--- a/docker/entrypoint.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2021 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 cfg_path=/etc/cgitize/cgitize.toml
-
-secure_repo_dir() {
- [ ! -e "$cfg_path" ] && return 0
-
- 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
-}
-
-main() {
- setup
- exec "$script_dir/run_cron.sh" "$@"
-}
-
-main "$@"
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 "$@"