File size: 1,024 Bytes
a62077e 3d66487 a62077e 1cd6149 a62077e |
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 |
FROM python:3.10
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
libffi-dev \
libsndfile1 \
libasound2 \
libxt6 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install PyTorch CPU first (2.6.0 available for CPU)
# RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0
RUN pip install --no-cache-dir typing-extensions==4.10.0
RUN pip install --no-cache-dir \
torch==2.6.0+cpu \
torchvision==0.21.0+cpu \
torchaudio==2.6.0+cpu \
--index-url https://download.pytorch.org/whl/cpu
# Install the rest of requirements
RUN pip install --no-cache-dir -r requirements.txt
# Download NLTK data required by g2p_en
RUN python -c "import nltk; nltk.download('averaged_perceptron_tagger_eng', quiet=True)"
# Copy application files
COPY . .
EXPOSE 7860
ENV PYTHONUNBUFFERED=1
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|