From 17df410300d14397b963a184ab3fdf854ea10ff3 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 4 Dec 2022 17:04:11 +0100 Subject: docker: make schedule.sh more reusable --- docker/Dockerfile | 4 +++- docker/schedule.sh | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'docker') 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 -- cgit v1.2.3