Files
peikarband/docker
Ehsan.Asadi 432aa63e36 feat: implement complete CI/CD with base image strategy
- Add Woodpecker pipeline with base image support
- Separate base image build (.woodpecker-base.yml) from app build (.woodpecker.yml)
- Implement build/push separation in application pipeline
- Create Docker base image with Python 3.11, Node.js 20, and bun
- Update Dockerfile to use pre-built base image for faster builds
- Remove GitHub Actions (not needed, using Woodpecker)
- Fix Docker contexts and paths for new structure
- Update docker-compose.yml build contexts
- Fix rxconfig.py DB path for container environment
- Add ArgoCD application manifests for staging/production
- Create comprehensive documentation:
  - docs/WOODPECKER_CI_CD.md (CI/CD guide)
  - docs/BASE_IMAGE_MANAGEMENT.md (Base image management)
  - helm/peikarband/argocd/README.md (ArgoCD deployment)

Benefits:
- Build time: 8-10min → 2-3min (60-70% faster)
- Better reliability (no repeated npm/bun downloads)
- Separation of concerns (base vs application builds)
- Full pipeline: check → build → push → verify → notify
- Complete deployment automation with Helm + ArgoCD

Pipeline stages:
1. check-base-image: Verify base image availability
2. build-image: Build application (no push)
3. push-image: Push with multi-tags (latest, sha, branch)
4. verify-push: Verify successful push
5. notify: Success/failure notifications

Base image can be rebuilt via:
- Manual trigger in Woodpecker UI
- Auto trigger when Dockerfile.base changes
2025-12-30 21:50:45 +03:30
..

Build Directory

این دایرکتوری شامل همه فایل‌های مربوط به build process پروژه است.

📁 ساختار

build/
├── docker/              # Docker configurations
│   ├── Dockerfile      # Main application Dockerfile
│   ├── Dockerfile.base # Base image reference
│   ├── docker-compose.yml # Local development
│   └── .dockerignore
└── ci/                 # CI/CD configurations
    └── woodpecker.yml  # Woodpecker CI pipeline

🐳 Docker

Dockerfile

Multi-stage Dockerfile برای بهینه‌سازی حجم image و امنیت:

  • Stage 1 (Builder): Build و compile
  • Stage 2 (Runtime): Image نهایی بدون build tools

Build:

make docker-build
# یا
docker build -f build/docker/Dockerfile -t peikarband/landing:latest .

Dockerfile.base

فایل مرجع برای base image که در repo جداگانه build می‌شود:

  • Repo: peikarband/base
  • Registry: hub.peikarband.ir/peikarband/base:latest

docker-compose.yml

برای development محلی:

make docker-up
# یا
docker-compose -f build/docker/docker-compose.yml up -d

🔄 CI/CD

woodpecker.yml

Woodpecker CI pipeline configuration:

  • Build Docker image
  • Push به Harbor registry
  • Tag with commit SHA
  • Cache optimization

تنظیمات مورد نیاز:

  • HARBOR_USERNAME: Harbor registry username
  • HARBOR_PASSWORD: Harbor registry password

🎯 Best Practices

  1. Docker Images

    • Multi-stage builds
    • Minimal runtime dependencies
    • Non-root user
    • Health checks
  2. CI/CD

    • Cache layers
    • Automated testing
    • Semantic versioning
    • Registry push on main branch only
  3. Security

    • Scan images for vulnerabilities
    • Sign images
    • Use specific versions (no :latest in production)

📚 مستندات بیشتر