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