# Lightweight Python base image (no GPU/PyTorch needed)
FROM python:3.11-slim

# Labels
LABEL maintainer="Jacob Schmieder"
LABEL email="Jacob.Schmieder@dbfz.de"
LABEL version="0.1.1.dev"
LABEL description="Scraibe: LocalAI-backed transcription and diarization client with summarization and custom Web GUI. \
                    Sends audio to a LocalAI server running vibevoice.cpp and uses a second LLM for summarization."
LABEL url="https://git.optimex.systems/admin/scribe"

# Install system dependencies (ffmpeg required)
RUN apt update -y && \
    apt install -y --no-install-recommends ffmpeg && \
    apt clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Working directory
WORKDIR /app/src

# Environment variables for LocalAI (transcription/diarization)
ENV LOCALAI_API_URL=http://localhost:8080
ENV LOCALAI_API_KEY=
ENV LOCALAI_MODEL=vibevoice-cpp-asr

# Environment variables for Summarizer LLM
ENV SUMMARIZER_API_URL=http://localhost:8080
ENV SUMMARIZER_API_KEY=
ENV SUMMARIZER_MODEL=qwen3-14b

# Gradio / Web GUI
ENV GRADIO_SERVER_NAME=0.0.0.0

# Copy and install Python dependencies
COPY requirements.txt /app/src/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY scraibe /app/src/scraibe

# Copy custom Web GUI assets (header, footer, templates, logos, config)
COPY misc /app/src/misc

# Expose port (for Web GUI)
EXPOSE 7860

# Run the Web GUI by default (never the CLI)
# Use python -m scraibe so __main__.py forces web GUI.
CMD ["python3", "-m", "scraibe"]
