# Application stage - builds on top of the base image
# First build the base image using: docker build -f Dockerfile.base -t ragflow-base:latest .
FROM ragflow-base:latest AS production
USER root

WORKDIR /ragflow

# Copy application source code (these files change frequently)
COPY api api
COPY conf conf
COPY deepdoc deepdoc
COPY rag rag
COPY agent agent
COPY graphrag graphrag
COPY agentic_reasoning agentic_reasoning
COPY pyproject.toml ./
COPY mcp mcp
COPY plugin plugin

# Copy configuration templates and entrypoint
COPY docker/service_conf.yaml.template ./conf/service_conf.yaml.template
COPY docker/entrypoint.sh ./
RUN chmod +x ./entrypoint*.sh

# Set the entrypoint
ENTRYPOINT ["./entrypoint.sh"]