ServerX commited on
Commit
a8170e1
·
verified ·
1 Parent(s): f9a2505

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -11
Dockerfile CHANGED
@@ -1,31 +1,23 @@
1
- # Dockerfile definitivo per Hugging Face Spaces
2
  FROM python:3.9-slim
3
 
4
- # Imposta la directory di lavoro
5
  WORKDIR /app
6
 
7
- # Aggiorna e installa le dipendenze di sistema
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  gcc \
10
  python3-dev \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Crea utente non-root e imposta i permessi
14
  RUN useradd -m -u 1000 user && \
15
  chown -R user:user /app
16
  USER user
17
 
18
- # Imposta il PATH per l'utente
19
- ENV PATH="/home/user/.local/bin:${PATH}" \
20
- PYTHONUNBUFFERED=1 \
21
- PYTHONDONTWRITEBYTECODE=1
22
 
23
- # Copia e installa le dipendenze Python
24
  COPY --chown=user requirements.txt .
25
  RUN pip install --no-cache-dir --user -r requirements.txt
26
 
27
- # Copia tutto il codice sorgente
28
  COPY --chown=user . .
29
 
30
- # Comando di avvio ottimizzato
31
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "600", "--preload", "--workers", "2", "app:app"]
 
 
1
  FROM python:3.9-slim
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
  RUN useradd -m -u 1000 user && \
11
  chown -R user:user /app
12
  USER user
13
 
14
+ ENV PYTHONUNBUFFERED=1 \
15
+ PYTHONDONTWRITEBYTECODE=1 \
16
+ PATH="/home/user/.local/bin:${PATH}"
 
17
 
 
18
  COPY --chown=user requirements.txt .
19
  RUN pip install --no-cache-dir --user -r requirements.txt
20
 
 
21
  COPY --chown=user . .
22
 
 
23
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--timeout", "600", "--preload", "--workers", "2", "app:app"]