phoneme_transciptor / Dockerfile
thanhhungtakeshi's picture
rm language-tool
76a5fa3
FROM python:3.10-slim
# Set environment variables
ENV HF_HOME=/tmp/hf_cache
ENV OMP_NUM_THREADS=1
ENV LIBROSA_CACHE_DISABLE=1
# Download and install nltk data
RUN pip install --no-cache-dir nltk
RUN mkdir -p /usr/local/nltk_data
RUN python -m nltk.downloader -d /usr/local/nltk_data averaged_perceptron_tagger averaged_perceptron_tagger_eng cmudict
ENV NLTK_DATA=/usr/local/nltk_data
# Download and install spacy model
RUN pip install --no-cache-dir spacy
ENV SPACY_DATA=/usr/local/spacy_models
RUN python -m spacy download en_core_web_sm
WORKDIR /app
# Install system dependencies (with Java 21)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
ffmpeg \
espeak-ng \
openjdk-21-jdk \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (better caching)
COPY requirements.txt .
# Install general dependencies from PyPI
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Install torch/torchaudio from the CUDA index
# RUN pip install torch==2.3.0+cu118 torchaudio==2.3.0+cu118 --index-url https://download.pytorch.org/whl/cu118
RUN pip install torch==2.6.0+cu118 torchaudio==2.6.0+cu118 --index-url https://download.pytorch.org/whl/cu118
# Copy app code
COPY . .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]