sw-jobs-api/scrapers/Dockerfile
christian a38aa4cd83
All checks were successful
Build and Push Docker Images / build (push) Successful in 39s
copy files
2024-06-01 18:07:45 +02:00

30 lines
730 B
Docker

# Use the official Python image from the Docker Hub
FROM python:3.12-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the script and requirements.txt into the container at /app
COPY jobindex.py .
COPY requirements.txt .
# Install the required Python packages
RUN pip install -r requirements.txt
# Install cron and create log file
RUN apt-get update \
&& apt-get -y install cron \
&& touch /var/log/cron.log
# 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
# Run the command on container startup
CMD ["cron", "-f"]