Skip to content

Commit

Permalink
[fix] Make updater cron jobs print to docker logs
Browse files Browse the repository at this point in the history
  • Loading branch information
georgejkaye committed Dec 20, 2023
1 parent 93b5d61 commit 673920c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion updater/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

ARG CRON="0 0 * * *"

RUN echo "${CRON} /app/.venv/bin/python /app/src/updater/main.py >> /var/log/cron.log 2>&1" > crontab
RUN echo "${CRON} /app/.venv/bin/python /app/src/updater/main.py > /tmp/stdout 2> /tmp/stderr" > crontab
RUN crontab crontab

COPY src ./app/src
Expand Down
8 changes: 8 additions & 0 deletions updater/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/bin/sh

# Make sure cron can see environment variables
printenv >> /etc/environment

# Set up stdour and stderr for docker logs
mkfifo /tmp/stdout /tmp/stderr
chmod 0666 /tmp/stdout /tmp/stderr
tail -f /tmp/stdout &
tail -f /tmp/stderr >&2 &

cron -f

0 comments on commit 673920c

Please sign in to comment.