# Use an official Python runtime as a parent image FROM python:3.9-slim # Install cron RUN apt-get update && apt-get install -y cron nano # Set the working directory WORKDIR /usr/cta-archive/ # Copy the current directory contents into the container COPY . . # Install any needed packages RUN pip install --no-cache-dir -r requirements.txt # Load environment variable into cron job, as these aren't automatically passed RUN echo '' # Copy the cron job file into the cron.d directory RUN echo ' */5 * * * * /usr/local/bin/python3 /usr/cta-archive/archive.py ' >> /usr/cta-archive/cronjob # Give execution rights on the cron job RUN chmod 0644 /usr/cta-archive/cronjob # Add cron job RUN crontab /usr/cta-archive/cronjob # Create logfile RUN touch /var/log/cron.log # Run the command on container startup ENTRYPOINT [ "/usr/cta-archive/entrypoint.sh" ]