mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
Converts hanzo-agent from git submodule to regular directory. This enables simpler cross-package refactoring and unified CI/CD. Source: github.com/hanzoai/agent.git (a8d7ec9)
58 lines
1.4 KiB
Docker
58 lines
1.4 KiB
Docker
# Multi-stage Dockerfile for Hanzo Agent SDK
|
|
# This Dockerfile creates a production-ready image for the Hanzo AI SDK
|
|
|
|
# Build stage
|
|
FROM python:3.12-slim AS builder
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install uv for fast Python package management
|
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files
|
|
COPY pyproject.toml uv.lock ./
|
|
|
|
# Install dependencies
|
|
RUN uv sync --frozen --no-dev
|
|
|
|
# Production stage
|
|
FROM python:3.12-slim
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN groupadd -r hanzo && useradd -r -g hanzo hanzo
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy virtual environment from builder
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
|
|
# Copy application code
|
|
COPY --chown=hanzo:hanzo . .
|
|
|
|
# Set environment variables
|
|
ENV PATH="/app/.venv/bin:${PATH}"
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Switch to non-root user
|
|
USER hanzo
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import agents; print('OK')" || exit 1
|
|
|
|
# Default command (can be overridden)
|
|
CMD ["python", "-m", "agents"] |