Eric2mangel commited on
Commit
5d5b3c4
·
verified ·
1 Parent(s): ecb8ac7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -7
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # syntax = docker/dockerfile:1.4
2
  FROM python:3.12-slim
3
 
4
- # Installe les dépendances système nécessaires pour Pillow, matplotlib, etc.
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
  gcc \
7
  g++ \
@@ -9,16 +9,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
9
  zlib1g-dev \
10
  libpng-dev \
11
  libfreetype6-dev \
12
- liblcms2-dev \
13
- libwebp-dev \
14
  libopenjp2-7-dev \
15
  libtiff5-dev \
 
 
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  WORKDIR /app
19
 
20
- # Copie et installe les dépendances Python
21
  COPY requirements.txt .
 
 
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
  # Copie le code et les données
@@ -26,8 +28,9 @@ COPY app.py .
26
  COPY faker_text.csv .
27
  COPY numeric_only.csv .
28
 
29
- # Très important pour HF Spaces
30
  EXPOSE 8501
31
 
32
- # Commande de lancement (obligatoire)
33
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
  # syntax = docker/dockerfile:1.4
2
  FROM python:3.12-slim
3
 
4
+ # Installe les dépendances système nécessaires pour Pillow/Matplotlib + compilation si besoin
5
  RUN apt-get update && apt-get install -y --no-install-recommends \
6
  gcc \
7
  g++ \
 
9
  zlib1g-dev \
10
  libpng-dev \
11
  libfreetype6-dev \
 
 
12
  libopenjp2-7-dev \
13
  libtiff5-dev \
14
+ curl \
15
+ git \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
  WORKDIR /app
19
 
20
+ # Copie requirements en premier (meilleur cache)
21
  COPY requirements.txt .
22
+
23
+ # Installe tout (sans cache pour réduire la taille finale)
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
  # Copie le code et les données
 
28
  COPY faker_text.csv .
29
  COPY numeric_only.csv .
30
 
31
+ # Port + commande obligatoire pour HF Spaces
32
  EXPOSE 8501
33
 
34
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
35
+
36
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]