chouchouvs commited on
Commit
10bf571
·
verified ·
1 Parent(s): ed3234a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -9
Dockerfile CHANGED
@@ -1,19 +1,28 @@
1
  FROM python:3.10-slim
2
 
3
- # Dépendances système minimales
4
- RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && \
 
5
  rm -rf /var/lib/apt/lists/*
6
 
7
- # Evite le cache pip, logs non-bufferisés
 
 
 
 
8
  ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
9
 
10
- # Copie et install des deps Python
11
- COPY requirements.txt /tmp/requirements.txt
12
  RUN pip install --no-cache-dir -r /tmp/requirements.txt
13
 
14
- # Copie du code (la Space a déjà cloné le repo dans le contexte de build)
15
- WORKDIR /app
16
- COPY . /app
 
 
 
 
17
 
18
  EXPOSE 7860
19
- CMD ["uvicorn", "rfp_api_app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ # Deps système
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ git ca-certificates && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
+ # User 'user' (comme HF)
9
+ RUN useradd -m -u 1000 user || true
10
+ USER user
11
+
12
+ # Confort Python
13
  ENV PIP_NO_CACHE_DIR=1 PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
14
 
15
+ # Install deps Python
16
+ COPY --chown=user:user requirements.txt /tmp/requirements.txt
17
  RUN pip install --no-cache-dir -r /tmp/requirements.txt
18
 
19
+ # Workspace
20
+ ENV WORKSPACE=/home/user/workspace
21
+ WORKDIR ${WORKSPACE}
22
+
23
+ # Entrypoint = script qui clone + lance uvicorn
24
+ COPY --chown=user:user entrypoint.sh /usr/local/bin/entrypoint.sh
25
+ RUN chmod +x /usr/local/bin/entrypoint.sh
26
 
27
  EXPOSE 7860
28
+ CMD ["/usr/local/bin/entrypoint.sh"]