File size: 972 Bytes
22d5f88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ffffaa4
 
 
 
 
22d5f88
 
ffffaa4
 
 
 
 
 
22d5f88
 
 
ffffaa4
 
22d5f88
 
 
 
 
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
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime

WORKDIR /app

# Install system dependencies
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    build-essential \
    python3-dev \
    git \
    ffmpeg \
    libsndfile1 \
    && rm -rf /var/lib/apt/lists/*

# Pre-install critical dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel

# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Create model cache directory with proper permissions
RUN mkdir -p /app/models && \
    chmod -R 777 /app/models

# Install package normally (not in editable mode)
RUN if [ -f "setup.py" ]; then pip install .; fi

# Environment variables
ENV MODEL_PATH=/app/models \
    TRANSFORMERS_CACHE=/app/models \
    HF_HOME=/app/models \
    PYTHONUNBUFFERED=1

EXPOSE 8000

CMD ["python", "server.py"]