Samimizhr commited on
Commit
c660593
·
verified ·
1 Parent(s): 2118139

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -9
Dockerfile CHANGED
@@ -2,20 +2,32 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- software-properties-common \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
- COPY requirements.txt ./
13
- COPY src/ ./src/
14
 
15
- RUN pip3 install -r requirements.txt
 
16
 
17
- EXPOSE 8501
 
18
 
19
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
 
 
 
20
 
21
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ ffmpeg \
 
 
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Copy requirements first for better caching
12
+ COPY requirements.txt .
13
 
14
+ # Install Python dependencies
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
 
17
+ # Copy application files
18
+ COPY . .
19
 
20
+ # Create a user (required by HuggingFace Spaces)
21
+ RUN useradd -m -u 1000 user
22
+ USER user
23
+ ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH
25
 
26
+ WORKDIR $HOME/app
27
+ COPY --chown=user . $HOME/app
28
+
29
+ # Expose port 7860 (required by HuggingFace Spaces)
30
+ EXPOSE 7860
31
+
32
+ # Run Streamlit
33
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]