51 lines
1.2 KiB
Docker
51 lines
1.2 KiB
Docker
|
|
FROM debian:trixie-slim
|
||
|
|
|
||
|
|
# Install system dependencies
|
||
|
|
RUN apt-get update && apt-get install -y \
|
||
|
|
python3-pip \
|
||
|
|
python3-dev \
|
||
|
|
git \
|
||
|
|
wget \
|
||
|
|
ffmpeg \
|
||
|
|
libsndfile1 \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Install ROCm runtime libraries (matching host setup)
|
||
|
|
RUN apt-get update && apt-get install -y \
|
||
|
|
rocm-Devkits=6.3.0 \
|
||
|
|
rocm-dev=6.3.0 \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Create non-root user
|
||
|
|
RUN useradd -m -u 1000 appuser
|
||
|
|
WORKDIR /app
|
||
|
|
COPY requirements.txt .
|
||
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
|
|
||
|
|
# Download models (will be cached in volume)
|
||
|
|
RUN mkdir -p /app/models && chown appuser:appuser /app/models
|
||
|
|
USER appuser
|
||
|
|
|
||
|
|
# Install TTS models (Coqui TTS with multilingual model)
|
||
|
|
RUN pip install --no-cache-dir TTS && \
|
||
|
|
tts --text "Initializing model..." --model_name tts_models/multilingual/multi-dataset/your_tts --out_path /tmp/init.wav || true
|
||
|
|
|
||
|
|
# Install faster-whisper
|
||
|
|
RUN pip install --no-cache-dir faster-whisper
|
||
|
|
|
||
|
|
# Expose port
|
||
|
|
EXPOSE 8000
|
||
|
|
|
||
|
|
# Switch to non-root user
|
||
|
|
USER appuser
|
||
|
|
|
||
|
|
# Copy application code
|
||
|
|
COPY app.py .
|
||
|
|
|
||
|
|
# Health check
|
||
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
||
|
|
|
||
|
|
# Command to run the application
|
||
|
|
CMD ["python", "app.py"]
|