diff --git a/Dockerfile b/Dockerfile index c631b32..111f883 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,30 @@ FROM python:3.10 + EXPOSE 80 + WORKDIR /app -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt +# Copier les fichiers nécessaires dans l'image +COPY requirements.txt . COPY generateurModele.py . COPY testFinal.py . COPY crontab . +# Installer les dépendances +RUN pip install --no-cache-dir -r requirements.txt + +# Créer le fichier de log RUN touch /app/cron.log +# Donner les permissions nécessaires RUN chmod 777 /app/crontab -RUN apt-get update -RUN apt-get -y install cron -ENTRYPOINT [ "cron" ,"&&","tail","-f", "/app/cron.log"] \ No newline at end of file +# Installer le service cron +RUN apt-get update && apt-get -y install cron + +# Copier le script d'entrée +COPY entrypoint.sh /app/entrypoint.sh +RUN chmod +x /app/entrypoint.sh + +# Définir le point d'entrée de l'image +ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..5166673 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Charger le fichier cron +crontab /app/crontab + +# Démarrer le service cron en arrière-plan +service cron start + +cron && tail -f /app/cron.log