File size: 1,029 Bytes
f21249a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # 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"]
|