File size: 1,137 Bytes
b2be5e3
 
0c8f7e3
c24eb47
0c8f7e3
 
b2be5e3
 
 
 
 
 
 
 
 
 
 
 
0c8f7e3
 
b2be5e3
 
 
 
 
 
3fb34eb
 
 
 
b2be5e3
ec35886
3fb34eb
 
 
 
 
ec35886
b2be5e3
eb23cbb
0c8f7e3
b2be5e3
15defb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Use slim Python base image
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install dependencies (ffmpeg, fonts, build tools, etc.)
RUN apt-get update && apt-get install -y \
    ffmpeg \
    libsndfile1 \
    build-essential \
    g++ \
    fonts-ebgaramond \
    fonts-dejavu \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first (for caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy project files
COPY api_server /app/api_server
COPY utils /app/utils
COPY video /app/video
COPY server.py /app/server.py

# Create writable directories
RUN mkdir -p /data/media /data/matplotlib /data/hf_cache /data/hf_home /data/numba_cache /data/nltk_data \
&& chmod -R 777 /data

# Environment settings
ENV STORAGE_PATH=/data/media
ENV MPLCONFIGDIR=/data/matplotlib
ENV HF_HOME=/data/hf_home
ENV TRANSFORMERS_CACHE=/data/hf_cache
ENV NUMBA_CACHE_DIR=/data/numba_cache
ENV NLTK_DATA=/data/nltk_data

# Expose HF Space default port
EXPOSE 7860

# Start FastAPI with uvicorn (HF expects web server on 0.0.0.0:7860)
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]