2025-09-18 19:51:47 +05:30
|
|
|
# Multi-stage Dockerfile
|
|
|
|
|
# Stage 1: Builder - Install Python dependencies
|
|
|
|
|
FROM python:3.12-slim AS builder
|
2025-09-09 14:37:32 +05:30
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
2025-09-18 19:51:47 +05:30
|
|
|
# Install git in builder stage (needed for pip install from git)
|
2025-09-09 14:37:32 +05:30
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
|
git \
|
|
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy and install requirements
|
2025-10-09 17:54:31 +05:30
|
|
|
COPY api/requirements.txt .
|
2025-09-11 19:08:17 +05:30
|
|
|
|
2026-02-05 13:10:33 +05:30
|
|
|
# Install CPU-only PyTorch FIRST to prevent CUDA/NVIDIA dependencies
|
|
|
|
|
# This satisfies torch dependency before other packages try to pull GPU version
|
|
|
|
|
RUN pip install --user --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
|
|
|
|
|
rm -rf /root/.cache/pip
|
|
|
|
|
|
2025-09-18 19:51:47 +05:30
|
|
|
# Install dependencies to user directory for easy copying
|
|
|
|
|
RUN pip install --user --no-cache-dir -r requirements.txt && \
|
|
|
|
|
# Clean up pip cache after installation
|
|
|
|
|
rm -rf /root/.cache/pip
|
2025-09-09 14:37:32 +05:30
|
|
|
|
2025-10-31 11:49:53 +05:30
|
|
|
# Copy and install pipecat from local submodule
|
|
|
|
|
COPY pipecat /tmp/pipecat
|
2026-03-24 15:24:07 +08:00
|
|
|
RUN pip install --user --no-cache-dir '/tmp/pipecat[cartesia,deepgram,openai,elevenlabs,groq,google,azure,sarvam,soundfile,silero,webrtc,local-smart-turn-v3,speechmatics,openrouter,camb]' && \
|
2026-04-11 18:29:19 +05:30
|
|
|
# Pre-download NLTK punkt_tab tokenizer data (required by pipecat at runtime)
|
|
|
|
|
python -c "import nltk; nltk.download('punkt_tab', quiet=True)" && \
|
2025-10-31 11:49:53 +05:30
|
|
|
# Clean up pip cache and temporary pipecat directory
|
|
|
|
|
rm -rf /root/.cache/pip /tmp/pipecat
|
2025-09-18 19:51:47 +05:30
|
|
|
|
|
|
|
|
# Remove unnecessary Python cache files from installed packages
|
|
|
|
|
RUN find /root/.local -type f -name '*.pyc' -delete && \
|
|
|
|
|
find /root/.local -type d -name '__pycache__' -delete && \
|
|
|
|
|
find /root/.local -type f -name '*.pyo' -delete
|
|
|
|
|
|
|
|
|
|
# Stage 2: Runtime - Minimal image with only runtime dependencies
|
|
|
|
|
FROM python:3.12-slim AS runner
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Only install ffmpeg (runtime dependency)
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
ffmpeg \
|
|
|
|
|
&& apt-get clean \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
# Copy Python packages from builder stage
|
|
|
|
|
COPY --from=builder /root/.local /root/.local
|
|
|
|
|
|
2026-04-11 18:29:19 +05:30
|
|
|
# Copy NLTK data (punkt_tab tokenizer) from builder stage
|
|
|
|
|
COPY --from=builder /root/nltk_data /root/nltk_data
|
|
|
|
|
|
2025-09-18 19:51:47 +05:30
|
|
|
# Make sure scripts in .local are available
|
|
|
|
|
ENV PATH=/root/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
|
# Set Python to not generate .pyc files in runtime
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
# Unbuffered output for better container logging
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
2025-09-11 19:08:17 +05:30
|
|
|
|
2025-09-18 19:51:47 +05:30
|
|
|
# Copy application code
|
2025-10-09 17:54:31 +05:30
|
|
|
COPY ./api ./api
|
2026-03-02 14:44:04 +05:30
|
|
|
COPY ./scripts/start_services_dev.sh ./scripts/start_services_dev.sh
|
2025-09-09 14:37:32 +05:30
|
|
|
|
2026-04-16 13:03:29 +05:30
|
|
|
# Product documentation — read at runtime by the MCP docs tools
|
|
|
|
|
# (search_dograh_docs / fetch_dograh_doc) so agents can learn Dograh.
|
|
|
|
|
COPY ./docs ./docs
|
|
|
|
|
|
2025-09-09 14:37:32 +05:30
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
|
|
2026-02-05 13:10:33 +05:30
|
|
|
# Disable file logging in Docker - logs go to stdout for docker logs
|
|
|
|
|
ENV LOG_TO_FILE=false
|
|
|
|
|
|
2025-09-09 14:37:32 +05:30
|
|
|
# Expose the port FastAPI will run on
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
# Run the FastAPI app with uvicorn
|
2026-03-02 14:44:04 +05:30
|
|
|
CMD ["./scripts/start_services_dev.sh"]
|