# Multi-stage Dockerfile for KerdosAI FROM python:3.10-slim as base # Set environment variables ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* # Development stage FROM base as development COPY requirements.txt . RUN pip install -r requirements.txt # Install development dependencies RUN pip install pytest pytest-cov pytest-mock black ruff mypy rich typer COPY . . CMD ["bash"] # Production stage FROM base as production # Copy only necessary files COPY requirements.txt . RUN pip install -r requirements.txt COPY *.py ./ COPY configs/ ./configs/ # Create non-root user RUN useradd -m -u 1000 kerdos && \ chown -R kerdos:kerdos /app USER kerdos # Expose port for API EXPOSE 8000 # Default command CMD ["python", "-m", "uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "8000"]