sw-jobs-api/scrapers/Dockerfile
ChrQR c390e7559d
All checks were successful
Build and Push Docker Images / build (push) Successful in 35s
install cron
2024-06-01 17:02:24 +02:00

28 lines
739 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 current directory contents into the container at /app
COPY . /app
# Install cron and the required Python packages
RUN apt-get update && apt-get install -y cron && \
pip install requests beautifulsoup4
# Copy and add a cron job to run the script every hour
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