Files
bruno a48c913971 feat: add complete Kubernetes deployment and CI/CD pipeline
Major Features:
- ☸️ Complete Helm Chart with OrbStack optimization
- 🐳 Production-ready multi-stage Dockerfile (ARM64 support)
- 🚀 One-click deployment script for Mac Studio + OrbStack
- 🔒 Comprehensive security integration (Trivy, Bandit, Safety, Gitleaks)
- 🤖 New k8s-helper Claude Code Skill for cluster management
- 🔄 Complete CI/CD pipeline with 8 stages
- 📚 Comprehensive deployment documentation

Deployment Components:
- Helm Chart with multi-environment support (dev/staging/prod)
- OrbStack-optimized values (single-node, local registry)
- All K8s resources: Deployment, Service, Ingress, ConfigMap, Secret, PVC, HPA
- Intelligent deployment script with auto-detection and verification
- Port forwarding automation

Claude Code Skills:
- k8s-helper: Cluster status, pod logs, health checks, port forwarding, shell access

CI/CD Pipeline:
- Code quality & security scanning
- Automated testing with coverage
- Multi-arch Docker builds (amd64, arm64)
- Container vulnerability scanning
- Auto-deploy to dev, manual approval for prod
- Post-deployment verification

Documentation:
- DEPLOYMENT-GUIDE.md: Complete 20+ page deployment guide
- QUICK-REFERENCE.md: Quick command reference
- CLAUDE.md: Updated project guide for Claude Code
- README.md: Updated with new features

Environment:
- Tested on Mac Studio (ARM64) + OrbStack K8s v1.33.5
- Docker 28.5.2, Helm v4.0.0, kubectl v1.33.3

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
2025-12-30 19:07:29 +08:00

57 lines
1.3 KiB
Docker

# Multi-stage build for production-ready Python application
FROM python:3.11-slim as builder
WORKDIR /build
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --user -r requirements.txt
# Production stage
FROM python:3.11-slim
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy Python dependencies from builder
COPY --from=builder /root/.local /root/.local
# Copy application code
COPY src/ ./src/
COPY scripts/ ./scripts/
COPY .env.example ./.env
# Create non-root user
RUN useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app && \
mkdir -p /app/data /app/.cache /tmp && \
chown -R appuser:appuser /app/data /app/.cache /tmp
# Set PATH
ENV PATH=/root/.local/bin:$PATH
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Switch to non-root user
USER appuser
# Run application
CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]