Ajuste Dockerfile

This commit is contained in:
Kenio 2025-12-05 10:27:54 -03:00
parent 64b07e74f7
commit 51c05a63ce

View file

@ -18,7 +18,8 @@ COPY . /app
RUN pip install --no-cache-dir -r requirements.txt
# Criar arquivo de cron que executa o script a cada 2 minutos
RUN echo "*/2 * * * * python /app/main.py >> /var/log/cron.log 2>&1" > /etc/cron.d/cronjob
# IMPORTANTE: usar python3 (não python)
RUN echo "*/2 * * * * /usr/local/bin/python3 /app/main.py >> /var/log/cron.log 2>&1" > /etc/cron.d/cronjob
# Dar permissão para o cron job
RUN chmod 0644 /etc/cron.d/cronjob
@ -29,8 +30,8 @@ RUN crontab /etc/cron.d/cronjob
# Criar arquivo de log
RUN touch /var/log/cron.log
# Expor porta (caso queira usar FastAPI também)
# Expor porta (opcional, caso use FastAPI)
EXPOSE 8000
# Comando final: iniciar o cron e manter o container ativo
# Iniciar cron e manter container ativo
CMD cron && tail -f /var/log/cron.log