parent
16f17205a9
commit
798c559c90
@ -0,0 +1,34 @@
|
||||
# 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"]
|
||||
@ -0,0 +1 @@
|
||||
0 13 * * * /usr/local/bin/python /app/script_getforecast.py >> /var/log/cron.log 2>&1
|
||||
@ -0,0 +1,18 @@
|
||||
# docker compose -f energyprices_docker-compose.yml up -d --build
|
||||
|
||||
version: "3.3"
|
||||
services:
|
||||
weatherforecast:
|
||||
restart: always
|
||||
container_name: weatherforecast
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/Amsterdam
|
||||
build:
|
||||
dockerfile: ./Dockerfile
|
||||
env_file:
|
||||
- .env
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 1
|
||||
@ -1,2 +1,6 @@
|
||||
pandas
|
||||
matplotlib
|
||||
qrcode[pil]
|
||||
Pillow
|
||||
reportlab
|
||||
requests
|
||||
python-dotenv
|
||||
|
||||
Loading…
Reference in new issue