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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -51
Dockerfile CHANGED
@@ -1,52 +1,55 @@
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
- libgl1-mesa-glb \
13
- git \
14
- && apt-get clean \
15
- && rm -rf /var/lib/apt/lists/*
16
-
17
- # Create non-root user for security (required by HF Spaces)
18
- RUN useradd -m -u 1000 user
19
- USER user
20
- ENV HOME=/home/user \
21
- PATH=/home/user/.local/bin:$PATH
22
-
23
- # Set working directory for user
24
- WORKDIR $HOME/app
25
-
26
- # Copy requirements first (for caching)
27
- COPY --chown=user:user requirements.txt .
28
-
29
- # Install Python dependencies
30
- RUN pip install --no-cache-dir --upgrade pip && \
31
- pip install --no-cache-dir -r requirements.txt
32
-
33
- # Copy application files
34
- COPY --chown=user:user . .
35
-
36
- # Create temp directory
37
- RUN mkdir -p temp
38
-
39
- # Expose Streamlit port
40
- EXPOSE 7860
41
-
42
- # Health check
43
- HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
44
-
45
- # Set environment variables for Streamlit
46
- ENV STREAMLIT_SERVER_PORT=7860 \
47
- STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
48
- STREAMLIT_SERVER_HEADLESS=true \
49
- STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
50
-
51
- # Run the application
 
 
 
52
  CMD ["streamlit", "run", "app.py"]
 
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"]