rairo commited on
Commit
81bbd83
·
verified ·
1 Parent(s): 1b69811

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -24
Dockerfile CHANGED
@@ -2,36 +2,31 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies
6
- RUN apt-get update && apt-get install -y \
7
- build-essential \
8
- curl \
9
- software-properties-common \
10
- git \
11
- ffmpeg \
12
- libsm6 \
13
- libxext6 \
14
- libxrender-dev \
15
- libgl1-mesa-glx \
16
- # Add fontconfig for font management
17
- fontconfig \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # --- FIX FOR PERMISSION ERRORS ---
21
- # Create writable cache directories inside the app's working directory
22
  RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig
23
- # Tell Matplotlib and Fontconfig to use these new directories
24
- ENV MPLCONFIGDIR /app/.cache/matplotlib
25
- ENV FONTCONFIG_PATH /app/.cache/fontconfig
26
- # --- END OF FIX ---
27
 
28
- COPY requirements.txt ./
29
- RUN pip3 install --no-cache-dir -r requirements.txt
30
 
 
31
  COPY src/ ./src/
 
32
 
33
- EXPOSE 8501
 
34
 
35
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
36
 
37
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # System deps
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx fontconfig \
 
 
 
 
 
 
 
 
 
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Cache dirs that must be writable
 
11
  RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig
12
+ ENV MPLCONFIGDIR=/app/.cache/matplotlib \
13
+ FONTCONFIG_PATH=/app/.cache/fontconfig
 
 
14
 
15
+ COPY requirements.txt .
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Copy code and Streamlit config
19
  COPY src/ ./src/
20
+ COPY .streamlit/ ./.streamlit/
21
 
22
+ # Expose the port the Space will hit
23
+ EXPOSE 7860
24
 
25
+ # IMPORTANT: use the port env var Hugging Face injects
26
+ ENV PORT=7860
27
 
28
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \
29
+ "--server.headless=true", \
30
+ "--server.port=7860", \
31
+ "--server.enableXsrfProtection=false", \
32
+ "--server.enableCORS=false"]