mirror of
https://github.com/zenlm/zen-family.git
synced 2026-10-30 14:58:06 +00:00
55 lines
1.4 KiB
Docker
55 lines
1.4 KiB
Docker
# Multi-stage build for Zen AI Models
|
|
FROM python:3.14-slim as builder
|
|
|
|
# Install build dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
build-essential \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy Docker-specific requirements
|
|
COPY requirements_docker.txt ./
|
|
|
|
# Install Python dependencies
|
|
RUN pip install --no-cache-dir -U pip setuptools wheel && \
|
|
pip install --no-cache-dir -r requirements_docker.txt
|
|
|
|
# Production stage
|
|
FROM python:3.14-slim
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 zen && \
|
|
mkdir -p /app/models /app/output /app/logs && \
|
|
chown -R zen:zen /app
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy Python packages from builder
|
|
COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages
|
|
COPY --from=builder /usr/local/bin /usr/local/bin
|
|
|
|
# Copy application code
|
|
COPY --chown=zen:zen . .
|
|
|
|
# Switch to non-root user
|
|
USER zen
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Default command - start API server
|
|
CMD ["python", "-m", "uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] |