FABLESLIP commited on
Commit
1932190
·
verified ·
1 Parent(s): 1296186

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Image Python légère et récente
2
+ FROM python:3.11-slim
3
+
4
+ # (1) Dépendances système
5
+ RUN apt-get update \
6
+ && apt-get install -y --no-install-recommends \
7
+ ffmpeg \
8
+ libglib2.0-0 \
9
+ libgomp1 \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # (2) Dossier de travail
13
+ WORKDIR /app
14
+
15
+ # (3) Installer dépendances Python
16
+ COPY requirements.txt /app/requirements.txt
17
+ RUN pip install --no-cache-dir --upgrade pip \
18
+ && pip install --no-cache-dir -r /app/requirements.txt
19
+
20
+ # (4) Utilisateur non-root + droits d’écriture
21
+ RUN useradd -m -u 1000 user \
22
+ && mkdir -p /app/data/_thumbs /app/data/_masks \
23
+ && chown -R user:user /app
24
+ USER user
25
+ ENV PATH="/home/user/.local/bin:${PATH}"
26
+
27
+ # (5) Copier tout le repo
28
+ COPY --chown=user:user . /app
29
+
30
+ # (6) Exposer le port attendu par Spaces et lancer Uvicorn sur $PORT
31
+ ENV PORT=7860
32
+ EXPOSE 7860
33
+ CMD ["bash","-lc","uvicorn app:app --host 0.0.0.0 --port ${PORT}"]