sw-jobs-api/scrapers/Dockerfile
christian f0aff65ba1
Some checks failed
Build and Push Docker Images / build (push) Failing after 26s
scraper dockerfile and cronjob to run when container starts
2024-06-01 17:56:06 +02:00

28 lines
709 B
Docker

# Use the official Python image from the Docker Hub
FROM python:3.9-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the script and requirements.txt into the container at /app
COPY jobindex.py /app/
COPY requirements.txt /app/
# Install the required Python packages
RUN pip install -r requirements.txt
# Copy the cron job file into the cron directory
COPY cronjob /etc/cron.d/jobindex-cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/jobindex-cron
# Apply cron job
RUN crontab /etc/cron.d/jobindex-cron
# 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