File size: 560 Bytes
a538b70
1a8e402
a538b70
 
1a8e402
 
 
 
 
 
 
a538b70
1a8e402
a538b70
 
 
1a8e402
4318ce5
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

WORKDIR /app

COPY api/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY api/ api/
COPY models/unet_mobilenet.keras models/

# Le port est lu dans la variable PORT : Cloud Run la fixe lui-même (8080),
# Hugging Face Spaces attend 7860 (valeur par défaut ici).
ENV PORT=7860
EXPOSE 7860
# exec : uvicorn devient le processus principal et reçoit le signal d'arrêt du conteneur
CMD ["sh", "-c", "exec uvicorn api.main:app --host 0.0.0.0 --port ${PORT}"]