You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
984 B
35 lines
984 B
# Gebruik een officiële Python-image als basis
|
|
FROM python:3.9-slim
|
|
|
|
RUN apt-get update && apt-get -y install cron nano procps
|
|
# Werkdirectory instellen
|
|
WORKDIR /app
|
|
|
|
# Kopieer je Python-bestanden naar de container
|
|
COPY . /app
|
|
|
|
# Kopieer de requirements.txt naar de container
|
|
COPY requirements.txt .
|
|
# Kopieer de requirements.txt naar de container
|
|
COPY .env .
|
|
|
|
# Installeer de vereiste Python dependencies
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Installeer cron en zorg ervoor dat de cron-demon actief is
|
|
RUN apt-get update && apt-get install -y cron
|
|
|
|
# Voeg het cron-script toe
|
|
COPY cronfile /etc/cron.d/cronfile
|
|
# Zorg ervoor dat het cron-script uitvoerbaar is
|
|
RUN chmod 0644 /etc/cron.d/cronfile
|
|
|
|
# Voeg een cronjob toe die de Python-script dagelijks uitvoert
|
|
RUN crontab /etc/cron.d/cronfile
|
|
|
|
# Voeg een cronjob toe die de Python-script dagelijks uitvoert
|
|
RUN crontab /etc/cron.d/cronfile
|
|
|
|
# Start de cron-demon en houd de container draaiend
|
|
CMD ["cron", "-f"]
|