Skip to content

Commit

Permalink
fix cron and add a docker-python-entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco MOSCARDINI committed Jan 9, 2025
1 parent d944863 commit aaa712a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion docker/python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ COPY --from=compiler /opt/venv /opt/venv
# install and configure cron daemon
RUN apt update; apt install cron libterm-readline-gnu-perl procps -y; apt -yq autoremove; apt clean
COPY etc/cron.d/syncro /etc/cron.d/syncro
COPY usr/local/bin/docker-python-entrypoint /usr/local/bin/docker-python-entrypoint

# Enable venv
ENV PATH="/opt/venv/bin:$PATH"
COPY ./scripts /app/

CMD ["/usr/sbin/cron", "-f", "-l", "15"]

# ENTRYPOINT ["/usr/sbin/cron", "-f", "-l", "15"]
ENTRYPOINT ["/usr/local/bin/docker-python-entrypoint"]
2 changes: 1 addition & 1 deletion etc/cron.d/syncro
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ LC_ALL=nb_NO.UTF-8
#
# m h dom mon dow command

30 18 * * * root /opt/venv/bin/python /app/synchro.py > /proc/1/fd/1 2>/proc/1/fd/2; root /opt/venv/bin/python /app/synchro.py push > /proc/1/fd/1 2>/proc/1/fd/2
0,30 0 * * * root /opt/venv/bin/python /app/synchro.py > /proc/1/fd/1 2>/proc/1/fd/2; root /opt/venv/bin/python /app/synchro.py push > /proc/1/fd/1 2>/proc/1/fd/2
7 changes: 7 additions & 0 deletions usr/local/bin/docker-python-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -e

env > /etc/environment
echo -------------------; echo Versions: ; python --version ; pip --version ; echo -------------------

exec "$@"

0 comments on commit aaa712a

Please sign in to comment.