aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-12-04 17:04:11 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2022-12-04 17:04:11 +0100
commit17df410300d14397b963a184ab3fdf854ea10ff3 (patch)
treecb9f9c4f239d94f7ceb2cb633ac25fdab2553767
parentt/i/docker: test the frontend also (diff)
downloadcgitize-17df410300d14397b963a184ab3fdf854ea10ff3.tar.gz
cgitize-17df410300d14397b963a184ab3fdf854ea10ff3.zip
docker: make schedule.sh more reusable
-rw-r--r--docker/Dockerfile4
-rwxr-xr-xdocker/schedule.sh6
2 files changed, 7 insertions, 3 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index b9f67db..0f2afdb 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -24,7 +24,9 @@ COPY ["docker/entrypoint.sh", "/"]
COPY ["docker/get_output_dir.py", "/"]
COPY ["docker/schedule.sh", "/"]
COPY ["cgitize/", "/usr/src/cgitize/"]
-WORKDIR /usr/src
+ENV SCHEDULE_ON_START=1
ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"]
+
+WORKDIR /usr/src
CMD ["python3", "-m", "cgitize.main"]
diff --git a/docker/schedule.sh b/docker/schedule.sh
index 0f3fa20..db7ae26 100755
--- a/docker/schedule.sh
+++ b/docker/schedule.sh
@@ -42,8 +42,10 @@ setup_cron_task() {
make_task_script "$@" > /task.sh
chmod +x /task.sh
- # Run the task once when the container is started, regardless of schedule.
- /task.sh
+ if [ -n "$SCHEDULE_ON_START" ]; then
+ # Run the task once when the container is started.
+ /task.sh
+ fi
local crontab
crontab="$schedule /task.sh