Skip to content

Commit c1a128d

Browse files
committed
Copy cron file into Docker container.
1 parent 58100d5 commit c1a128d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,8 @@ RUN apt-get update && apt-get install -y cron && rm -rf /var/lib/apt/lists/*
5050
# Switch back to root to run cron
5151
USER root
5252

53-
# Start cron in the foreground
54-
ENTRYPOINT ["cron", "-f", "-L", "2"]
53+
COPY entrypoint-cron.sh /entrypoint-cron.sh
54+
RUN chmod +x /entrypoint-cron.sh
55+
56+
# Copies crontab and starts cron in the foreground
57+
ENTRYPOINT ["/entrypoint-cron.sh"]

entrypoint-cron.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -f /mnt/crontab ]; then
5+
cp /mnt/crontab /etc/cron.d/elogen-cron
6+
chmod 644 /etc/cron.d/elogen-cron
7+
chown root:root /etc/cron.d/elogen-cron
8+
else
9+
echo "No crontab found at /mnt/crontab"
10+
fi
11+
12+
# Do not exit container, but start cron in any case.
13+
exec cron -f -L 2

0 commit comments

Comments
 (0)