Files
cta-archive/Dockerfile
T
2026-07-18 14:22:16 +08:00

29 lines
704 B
Docker

# 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
# 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
# Copy the cron job file into the cron.d directory
COPY cronjob /etc/cron.d/cronjob
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/cronjob
# Apply the cron job
RUN crontab /etc/cron.d/cronjob
# Create the log file to be able to run tail
RUN touch /var/log/cron.log
# Run the command on container startup
CMD cron && tail -f /var/log/cron.log