# Audio Transcription Service - Dockerfile
# Uses faster-whisper for optimized speech-to-text transcription

FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04

# Prevent interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Bucharest

# Install Python 3.10 (default in Ubuntu 22.04) and system dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    curl \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/* \
    && ln -sf /usr/bin/python3 /usr/bin/python

# Set working directory
WORKDIR /app

# Copy project files
COPY pyproject.toml /app/
COPY src/ /app/src/

# Install Python dependencies
RUN pip install --no-cache-dir -e .

# Create cache directory
RUN mkdir -p /root/.cache/huggingface

# Default port
ENV AUDIO_PORT=54300

# Expose port
EXPOSE 54300

# Run FastAPI with uvicorn
CMD python -m uvicorn audio.app:app --host 0.0.0.0 --port ${AUDIO_PORT}
