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.
36 lines
997 B
36 lines
997 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.energie /etc/cron.d/cronfile.energie
|
|
# Zorg ervoor dat het cron-script uitvoerbaar is
|
|
RUN chmod 0644 /etc/cron.d/cronfile.energie
|
|
|
|
# Voeg een cronjob toe die de Python-script dagelijks uitvoert
|
|
RUN crontab /etc/cron.d/cronfile.energie
|
|
|
|
|
|
# Voeg start.sh toe
|
|
COPY start.sh /start.sh
|
|
RUN chmod +x /start.sh
|
|
|
|
# Gebruik start.sh om zowel cron als currentprice.py te starten
|
|
CMD ["/start.sh"] |