sam12345324 commited on
Commit
b2be5e3
·
verified ·
1 Parent(s): eb23cbb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -21
Dockerfile CHANGED
@@ -1,32 +1,37 @@
1
- # Use Python base image
2
- FROM python:3.10
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy project files
8
- COPY . /app
9
-
10
- # Install requirements
 
 
 
 
 
 
 
 
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Create writable directories
14
- RUN mkdir -p /data/media /data/matplotlib /data/hf_cache /data/hf_home /data/numba_cache /data/nltk_data \
15
- && chmod -R 777 /data
16
-
17
- # Pre-download NLTK punkt + punkt_tab into /data/nltk_data
18
- RUN python -m nltk.downloader punkt punkt_tab -d /data/nltk_data
19
-
20
- # Environment variables for cache + storage
 
21
  ENV STORAGE_PATH=/data/media
22
- ENV MPLCONFIGDIR=/data/matplotlib
23
- ENV HF_HOME=/data/hf_home
24
- ENV TRANSFORMERS_CACHE=/data/hf_cache
25
- ENV NUMBA_CACHE_DIR=/data/numba_cache
26
- ENV NLTK_DATA=/data/nltk_data
27
 
28
- # Expose the Hugging Face default port
29
  EXPOSE 7860
30
 
31
- # Run FastAPI server (ensure server.py has `app = FastAPI()`)
32
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use slim Python base image
2
+ FROM python:3.10-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install dependencies (ffmpeg, fonts, build tools, etc.)
8
+ RUN apt-get update && apt-get install -y \
9
+ ffmpeg \
10
+ libsndfile1 \
11
+ build-essential \
12
+ g++ \
13
+ fonts-ebgaramond \
14
+ fonts-dejavu \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Copy requirements first (for caching)
18
+ COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy project files
22
+ COPY api_server /app/api_server
23
+ COPY utils /app/utils
24
+ COPY video /app/video
25
+ COPY server.py /app/server.py
26
+
27
+ # Environment settings
28
+ ENV PYTHONUNBUFFERED=1
29
+ # Make Hugging Face persistent storage available
30
  ENV STORAGE_PATH=/data/media
31
+ RUN mkdir -p /data/media && chmod -R 777 /data
 
 
 
 
32
 
33
+ # Expose HF Space default port
34
  EXPOSE 7860
35
 
36
+ # Start FastAPI with uvicorn (HF expects web server on 0.0.0.0:7860)
37
  CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]