From 3064fe5492766dd0dc610d6efd880f62fc1bece5 Mon Sep 17 00:00:00 2001 From: klemek Date: Mon, 20 Apr 2026 18:58:11 +0200 Subject: [PATCH] build: compose with a crontab --- .gitignore | 3 ++- Dockerfile | 4 ++-- compose.example.yml | 17 +++++++++++++---- crontab.example | 3 +++ 4 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 crontab.example diff --git a/.gitignore b/.gitignore index 9626cc8..ae79ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ compose.yml letsencrypt .coverage htmlcov -coverage.xml \ No newline at end of file +coverage.xml +crontab \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d500c34..38bbd76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,9 +22,9 @@ RUN PIP_ROOT_USER_ACTION=ignore python3 -m pip install uv COPY uv.lock pyproject.toml ./ -RUN uv sync --no-dev +RUN uv pip install -r pyproject.toml --system COPY main.py favicon.ico ./ COPY src/* ./src/ -ENTRYPOINT [ "uv", "run", "--no-sync", "main.py"] \ No newline at end of file +ENTRYPOINT [ "/app/main.py"] \ No newline at end of file diff --git a/compose.example.yml b/compose.example.yml index 9de1985..62ba112 100644 --- a/compose.example.yml +++ b/compose.example.yml @@ -10,7 +10,16 @@ services: volumes: - "./data:/data" - "./letsencrypt:/etc/letsencrypt" - environment: - - HOST=${HOST} - - TOKEN_SALT=${TOKEN_SALT} - command: run + env_file: .env + command: --debug run + + stapler-crontab: + build: . + restart: unless-stopped + volumes: + - "./data:/data" + - "./letsencrypt:/etc/letsencrypt" + - "./crontab:/etc/crontabs/root" + env_file: .env + entrypoint: /usr/sbin/crond -f + diff --git a/crontab.example b/crontab.example new file mode 100644 index 0000000..9116971 --- /dev/null +++ b/crontab.example @@ -0,0 +1,3 @@ +# do daily/weekly/monthly maintenance +# min hour day month weekday command +0 3 * * 1 /app/main.py renew \ No newline at end of file