ServerX commited on
Commit
0d426da
·
verified ·
1 Parent(s): 997d21b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -13
Dockerfile CHANGED
@@ -2,29 +2,30 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Installazione dipendenze di sistema
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  gcc \
8
  python3-dev \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Configurazione utente sicura
12
- RUN useradd -m -u 1000 user && \
13
- chown -R user:user /app
14
- USER user
15
-
16
- # Variabili d'ambiente
17
- ENV PYTHONUNBUFFERED=1 \
18
  PYTHONDONTWRITEBYTECODE=1 \
19
  PORT=7860 \
20
  TIMEOUT=300
21
 
22
- # Installazione dipendenze Python
 
 
 
 
 
 
23
  COPY --chown=user requirements.txt .
24
- RUN pip install --no-cache-dir --user -r requirements.txt
 
25
 
26
- # Copia il codice
27
  COPY --chown=user . .
28
 
29
- # Comando di avvio
30
- CMD ["gunicorn", "--bind", "0.0.0.0:${PORT}", "--timeout", "${TIMEOUT}", "--workers", "2", "app:app"]
 
2
 
3
  WORKDIR /app
4
 
 
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
  gcc \
7
  python3-dev \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Configurazione PATH esplicita
11
+ ENV PATH="/home/user/.local/bin:${PATH}" \
12
+ PYTHONUNBUFFERED=1 \
 
 
 
 
13
  PYTHONDONTWRITEBYTECODE=1 \
14
  PORT=7860 \
15
  TIMEOUT=300
16
 
17
+ # Crea utente e imposta permessi
18
+ RUN useradd -m -u 1000 user && \
19
+ chown -R user:user /app
20
+
21
+ USER user
22
+
23
+ # Installazione dipendenze
24
  COPY --chown=user requirements.txt .
25
+ RUN pip install --no-cache-dir --user gunicorn==20.1.0 && \
26
+ pip install --no-cache-dir --user -r requirements.txt
27
 
 
28
  COPY --chown=user . .
29
 
30
+ # Comando ottimizzato
31
+ CMD ["gunicorn", "--bind", "0.0.0.0:${PORT}", "--timeout", "${TIMEOUT}", "app:app"]