FROM ollama/ollama:latest # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ python3-pip \ git \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements first to leverage Docker cache COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Install Playwright browsers RUN python -m playwright install --with-deps chromium # Copy application files COPY app.py . COPY mcp_tools.py . # Pull AI models RUN ollama pull gemma3n:2b && \ ollama pull codeqwen:7b # Create a non-root user and switch to it RUN useradd -m appuser && chown -R appuser:appuser /app USER appuser # Expose ports EXPOSE 8000 EXPOSE 11434 # Health check HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8000/health || exit 1 # Start script COPY start.sh . RUN chmod +x ./start.sh # Start services CMD ["./start.sh"]