FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip \ ffmpeg libsndfile1 \ && rm -rf /var/lib/apt/lists/* RUN ln -sf /usr/bin/python3 /usr/bin/python WORKDIR /app # Install PyTorch with CUDA 12.1 RUN pip install --no-cache-dir \ torch==2.5.1 torchaudio==2.5.1 \ --index-url https://download.pytorch.org/whl/cu121 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN python -c "from transformers import Wav2Vec2Config; Wav2Vec2Config.from_pretrained('facebook/wav2vec2-large-xlsr-53', cache_dir='/app/w2v_cache')" COPY model/ /app/model/ COPY api.py . RUN mkdir -p /app/weights COPY weights/ /app/weights/ EXPOSE 8005 RUN adduser --disabled-password --gecos '' appuser USER appuser CMD ["python", "api.py"]