FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /app

# Install dependencies
COPY app/requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt && rm -f /tmp/requirements.txt

# Copy application code
COPY app/ /app/

# Copy documentation for auto-indexing
COPY docs/ /app/docs/

# Make entrypoint executable
RUN chmod +x /app/entrypoint.sh

EXPOSE 8000

# Use custom entrypoint for startup indexing
ENTRYPOINT ["/app/entrypoint.sh"]
