-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (20 loc) · 908 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM ubuntu:18.04
LABEL maintainer="Julien Marrec <julien@effibem.com>"
LABEL version="1.0"
LABEL description="A test container to run a cron job every 1 minute to run a python script and do some timestamp logging as well."
WORKDIR /var/test/
# Send build context (cf .dockerignore) to WORKDIR
ADD . .
RUN apt-get update && apt-get install -y cron python3
# This will correctly install dependencies as listed in setup.py (if setup.py is correct)
# RUN pip3 install -e .
# Copy run-1min-cron file to the cron.d directory
COPY run-1min-cron /etc/cron.d/run-1min-cron
# Give execution rights on the cron job
# Apply cron job
# Create the log file to be able to run tail
RUN chmod 0644 /etc/cron.d/run-1min-cron &&\
crontab /etc/cron.d/run-1min-cron &&\
touch /var/log/cron.log
# Run the command on container startup (this is an alternative to entrypoint.sh)
CMD cron && tail -f /var/log/cron.log