فهرست منبع

Preparazione installazione su docker nel server

Fabio Antonelli 7 ماه پیش
والد
کامیت
94de0e1f0a
2فایلهای تغییر یافته به همراه37 افزوده شده و 0 حذف شده
  1. 28 0
      Backend/Dockerfile
  2. 9 0
      docker-compose.yaml

+ 28 - 0
Backend/Dockerfile

@@ -0,0 +1,28 @@
+# 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"]

+ 9 - 0
docker-compose.yaml

@@ -0,0 +1,9 @@
+services:
+  daita25:
+    image: daita25:1.0
+    ports:
+      - "8000:80"
+#    environment:
+#      - SQLALCHEMY_DATABASE_URI = "postgresql://postgres:postgres@localhost:5432/generation"
+    restart: "unless-stopped"
+    build: ./Backend