diff --git a/.claude/checkpoints/1754570824.json b/.claude/checkpoints/1754570824.json new file mode 100644 index 0000000000..7001c32066 --- /dev/null +++ b/.claude/checkpoints/1754570824.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250807-124704", "file": "/workspaces/claude-code-flow/examples/litellm/docker-compose.yml", "timestamp": "2025-08-07T12:47:04Z", "type": "pre-edit", "original_branch": "alpha-88"} diff --git a/.claude/checkpoints/1754570826.json b/.claude/checkpoints/1754570826.json new file mode 100644 index 0000000000..55a5552311 --- /dev/null +++ b/.claude/checkpoints/1754570826.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250807-124706", "file": "/workspaces/claude-code-flow/examples/litellm/docker-compose.yml", "timestamp": "2025-08-07T12:47:06Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 6 +- .claude-flow/metrics/system-metrics.json | 72 ++++++++ .claude-flow/metrics/task-metrics.json | 14 +- .claude/checkpoints/1754570742.json | 1 + .claude/checkpoints/1754570745.json | 1 + examples/litellm/docker-compose.yml | 288 +++++++++++++++++++++++++++++++ 6 files changed, 368 insertions(+), 14 deletions(-) "} diff --git a/examples/litellm/docker/Dockerfile b/examples/litellm/docker/Dockerfile new file mode 100644 index 0000000000..1b7c9ae154 --- /dev/null +++ b/examples/litellm/docker/Dockerfile @@ -0,0 +1,68 @@ +# Multi-stage build for optimized LiteLLM proxy +FROM python:3.11-slim as builder + +# Install build dependencies +RUN apt-get update && apt-get install -y \ + gcc \ + g++ \ + make \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Create virtual environment +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +# Install Python dependencies +COPY requirements.txt /tmp/ +RUN pip install --upgrade pip && \ + pip install --no-cache-dir -r /tmp/requirements.txt + +# Production stage +FROM python:3.11-slim + +# Install runtime dependencies +RUN apt-get update && apt-get install -y \ + curl \ + postgresql-client \ + redis-tools \ + && rm -rf /var/lib/apt/lists/* + +# Copy virtual environment from builder +COPY --from=builder /opt/venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + +# Create app user +RUN useradd -m -u 1000 litellm && \ + mkdir -p /app/logs /app/cache /app/tenants && \ + chown -R litellm:litellm /app + +WORKDIR /app + +# Copy application files +COPY --chown=litellm:litellm entrypoint.sh /app/ +COPY --chown=litellm:litellm healthcheck.py /app/ + +# Make scripts executable +RUN chmod +x /app/entrypoint.sh + +# Switch to non-root user +USER litellm + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD python /app/healthcheck.py || exit 1 + +# Expose ports +EXPOSE 4000 9090 + +# Set environment variables +ENV LITELLM_MODE=production \ + LITELLM_PORT=4000 \ + LITELLM_HOST=0.0.0.0 \ + PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 + +# Entry point +ENTRYPOINT ["/app/entrypoint.sh"] +CMD ["--config", "/app/config.yaml"] \ No newline at end of file