File size: 1,191 Bytes
00a0ae0
6d01d5b
 
0889e65
6d01d5b
 
00a0ae0
9fe59b0
 
00a0ae0
 
dc871e9
00a0ae0
 
08d7c19
 
00a0ae0
 
08d7c19
 
 
 
 
6d01d5b
00a0ae0
08d7c19
6d01d5b
00a0ae0
0889e65
08d7c19
 
00a0ae0
 
 
 
6d01d5b
 
08d7c19
 
 
00a0ae0
6d01d5b
 
08d7c19
00a0ae0
 
0889e65
00a0ae0
 
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
45
46
47
48
49
50
# Use Python 3.10 slim for ML workloads
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    DEBIAN_FRONTEND=noninteractive \
    PORT=7860

# Install system dependencies
RUN apt-get update && apt-get install -y \
    ffmpeg \
    libsndfile1 \
    libasound2-dev \
    portaudio19-dev \
    wget \
    curl \
    git \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements-hf.txt .

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements-hf.txt

# Install PyTorch CPU (before copying app code)
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

# Copy app source code
COPY . .

# Create necessary directories
RUN mkdir -p vector_store logs

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860/ || exit 1

# Run FastAPI app
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]