nihun commited on
Commit
ff704a6
·
verified ·
1 Parent(s): 1ed6f65

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -35
Dockerfile CHANGED
@@ -1,55 +1,31 @@
1
- # Use Python base image
2
  FROM python:3.10-slim
3
 
4
- # Set working directory
5
  WORKDIR /app
6
 
7
  # Install system dependencies including FFmpeg
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- ffmpeg \
10
- libsm6 \
11
- libxext6 \
12
- libxrender1 \
13
- libgl1 \
14
- libglib2.0-0 \
15
- git \
16
  curl \
17
- && apt-get clean \
 
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # Create non-root user for security (required by HF 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
- # Set working directory for user
27
- WORKDIR $HOME/app
28
-
29
- # Copy requirements first (for caching)
30
- COPY --chown=user:user requirements.txt .
31
-
32
- # Install Python dependencies
33
- RUN pip install --no-cache-dir --upgrade pip && \
34
- pip install --no-cache-dir -r requirements.txt
35
 
36
  # Copy application files
37
- COPY --chown=user:user . .
38
 
39
  # Create temp directory
40
  RUN mkdir -p temp
41
 
42
- # Expose Streamlit port
43
  EXPOSE 7860
44
 
45
  # Health check
46
- HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
47
-
48
- # Set environment variables for Streamlit
49
- ENV STREAMLIT_SERVER_PORT=7860 \
50
- STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
51
- STREAMLIT_SERVER_HEADLESS=true \
52
- STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
53
 
54
  # Run the application
55
- CMD ["streamlit", "run", "app.py"]
 
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies including FFmpeg
6
+ RUN apt-get update && apt-get install -y \
7
+ build-essential \
 
 
 
 
 
 
8
  curl \
9
+ git \
10
+ ffmpeg \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy and install requirements
14
+ COPY requirements.txt ./
 
 
 
15
 
16
+ RUN pip3 install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
17
 
18
  # Copy application files
19
+ COPY . .
20
 
21
  # Create temp directory
22
  RUN mkdir -p temp
23
 
24
+ # Expose port for HF Spaces
25
  EXPOSE 7860
26
 
27
  # Health check
28
+ HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
 
 
 
 
 
 
29
 
30
  # Run the application
31
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]