# Example Dockerfile showing how to use the new startup system
# This is a reference - not meant to replace your existing Dockerfile

FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Runtime dependency for api.services.docling fast-path geometry (pdftotext -bbox).
RUN apt-get update \
    && apt-get install -y --no-install-recommends poppler-utils \
    && rm -rf /var/lib/apt/lists/*

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

# Copy application code
COPY . .

# Make startup scripts executable
RUN chmod +x start.sh
RUN chmod +x docker-entrypoint.sh

# Set environment variables
ENV PYTHONPATH=/app
ENV UVICORN_PORT=8000
ENV UVICORN_WORKERS=4

# Expose port
EXPOSE 8000

# Use the production entrypoint script (supports initialization)
ENTRYPOINT ["./docker-entrypoint.sh"]

# Alternative: Run initialization first, then production server
# CMD ["sh", "-c", "./start.sh init && ./start.sh prod"]

# Alternative: Use Python directly
# CMD ["python3", "main.py", "--mode", "prod"]
