# Phase 5: Production Dockerfile for RAG Pipeline Optimizer FROM python:3.12-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ git-lfs \ && rm -rf /var/lib/apt/lists/* # Initialize Git LFS RUN git lfs install # Copy requirements first (for Docker layer caching) COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy project files COPY config/ ./config/ COPY core/ ./core/ COPY utils/ ./utils/ COPY scripts/ ./scripts/ COPY app/ ./app/ COPY data/ ./data/ # Create necessary directories RUN mkdir -p logs chroma_db # Expose Streamlit port EXPOSE 8501 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD curl --fail http://localhost:8501/_stcore/health || exit 1 # Copy and make startup script executable COPY startup.sh /app/ RUN chmod +x /app/startup.sh # Run startup script (which downloads data and starts Streamlit) CMD ["/app/startup.sh"]