Dockerfile 816 B

12345678910111213141516171819202122232425262728
  1. # Usa l'immagine Python leggera
  2. FROM python:3.12-slim
  3. # Set non-interactive frontend
  4. ENV DEBIAN_FRONTEND=noninteractive
  5. # Aggiorna i pacchetti e installa le dipendenze di sistema
  6. RUN apt-get update && apt-get install -y --no-install-recommends \
  7. tzdata \
  8. build-essential && \
  9. apt-get clean && rm -rf /var/lib/apt/lists/*
  10. # Set the timezone (replace "Europe/Rome" with your timezone)
  11. RUN echo "Europe/Rome" > /etc/timezone && \
  12. ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime && \
  13. dpkg-reconfigure -f noninteractive tzdata
  14. COPY . /var/www/myapp
  15. WORKDIR /var/www/myapp
  16. RUN pip install --no-cache-dir -r requirements.txt gunicorn
  17. EXPOSE 80
  18. # Il Numero di worker = (numero CPU) * 2 + 1
  19. CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:80", "main:app"]