giangimene commited on
Commit
01905d4
·
verified ·
1 Parent(s): 93c8b47

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -5
Dockerfile CHANGED
@@ -1,7 +1,19 @@
1
  FROM python:3.10
2
- WORKDIR /app
3
- COPY requirements.txt .
4
- RUN pip install --no-cache-dir -r requirements.txt
5
- COPY . .
6
- EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
 
 
7
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
  FROM python:3.10
2
+
3
+ # 1. Crea l'utente speciale richiesto da Hugging Face (ID 1000)
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+ ENV PATH="/home/user/.local/bin:$PATH"
7
+
8
+ # 2. Imposta la cartella di lavoro
9
+ WORKDIR /home/user/app
10
+
11
+ # 3. Copia le librerie e installale (dando i permessi all'utente)
12
+ COPY --chown=user ./requirements.txt requirements.txt
13
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
+
15
+ # 4. Copia il resto del codice (il tuo app.py)
16
+ COPY --chown=user . /home/user/app
17
+
18
+ # 5. Lancia Streamlit sulla porta giusta
19
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]