Peeble commited on
Commit
3506f8c
·
verified ·
1 Parent(s): b789fd7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -33
Dockerfile CHANGED
@@ -1,44 +1,37 @@
1
- # Dockerfile for Veo 3 Gradio app on Hugging Face Spaces
2
- FROM python:3.11-slim
3
 
4
- # Install system dependencies for video/audio processing
5
- RUN apt-get update && apt-get install -y --no-install-recommends \
6
  ffmpeg \
7
- libgl1-mesa-glx \
8
- libglib2.0-0 \
9
- libsm6 \
10
- libxext6 \
11
- libxrender-dev \
12
- libgomp1 \
13
- wget \
14
- && rm -rf /var/lib/apt/lists/*
15
-
16
- # Set working directory
17
- WORKDIR /app
18
-
19
- # Copy requirements first for better Docker layer caching
20
  COPY requirements.txt .
21
 
22
- # Install Python dependencies with cache mount
23
- RUN --mount=type=cache,target=/root/.cache/pip \
24
- pip install --no-cache-dir -r requirements.txt
 
 
25
 
26
- # Copy application code
27
- COPY . .
28
 
29
- # Create symlinks for Gradio/Spaces compatibility
30
- RUN mkdir -p /home/user && \
31
- ln -sf /app /home/user/app || true
 
32
 
33
- # Switch to non-root user for security
34
- RUN useradd -m -u 1000 user && chown -R user:user /app
 
35
  USER user
36
 
37
- # Expose Gradio port
38
  EXPOSE 7860
39
-
40
- # Health check
41
- HEALTHCHECK CMD curl --fail http://localhost:7860 || exit 1
42
-
43
- # Run the application
44
  CMD ["python", "app.py"]
 
1
+ # Use HF Spaces optimized base (eliminates pipfreeze stage)
2
+ FROM python:3.12-slim
3
 
4
+ # Install ONLY essential system deps - no extra libs causing cache conflicts
5
+ RUN apt-get update -qq && apt-get install -y --no-install-recommends \
6
  ffmpeg \
7
+ libgl1 \
8
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Set unbuffered Python + working dir
11
+ ENV PYTHONUNBUFFERED=1
12
+ WORKDIR /code
13
+
14
+ # Copy ONLY requirements (pin exact versions, no wildcards)
 
 
 
 
 
15
  COPY requirements.txt .
16
 
17
+ # Force clean pip install WITHOUT cache mounts (HF Spaces ignores them)
18
+ RUN pip install --no-cache-dir --disable-pip-version-check \
19
+ pip==24.2 \
20
+ && pip install --no-cache-dir -r requirements.txt \
21
+ && pip cache purge
22
 
23
+ # Copy app AFTER pip (isolates code changes)
24
+ COPY app.py .
25
 
26
+ # HF Spaces Gradio compatibility symlinks
27
+ RUN mkdir -p /home/user/app && \
28
+ ln -sf /code /home/user/app && \
29
+ ln -sf /code/app.py /home/user/app/app.py
30
 
31
+ # Non-root user (HF Spaces requirement)
32
+ RUN adduser --disabled-password --gecos '' user && \
33
+ chown -R user:1000 /code
34
  USER user
35
 
 
36
  EXPOSE 7860
 
 
 
 
 
37
  CMD ["python", "app.py"]