chore: add repository strategy doc and helper scripts
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Add docs/REPOSITORY_STRATEGY.md for future reference - Add build-base-image.sh for local base image build - Add restore-files.sh for pipeline file management - Restore correct pipeline file names
This commit is contained in:
94
docs/REPOSITORY_STRATEGY.md
Normal file
94
docs/REPOSITORY_STRATEGY.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# Repository Strategy
|
||||
|
||||
## استراتژی فعلی: Single Repository ✅
|
||||
|
||||
همه چیز در یک repository: `peikarband/landing`
|
||||
|
||||
### مزایا:
|
||||
- ساده و قابل مدیریت
|
||||
- همه چیز در یک جا
|
||||
- مناسب برای یک پروژه
|
||||
|
||||
### ساختار:
|
||||
```
|
||||
peikarband/landing/
|
||||
├── .woodpecker.yml # Application pipeline
|
||||
├── .woodpecker-base.yml # Base image pipeline
|
||||
├── docker/
|
||||
│ ├── Dockerfile # Application
|
||||
│ └── Dockerfile.base # Base image
|
||||
└── ...
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## استراتژی آینده: Multi Repository (اختیاری)
|
||||
|
||||
اگر پروژههای بیشتری اضافه شد، میتوانید base را جدا کنید.
|
||||
|
||||
### مراحل جداسازی:
|
||||
|
||||
#### 1. ایجاد Repository جدید
|
||||
|
||||
```bash
|
||||
# Create new repo
|
||||
mkdir peikarband-base-images
|
||||
cd peikarband-base-images
|
||||
git init
|
||||
|
||||
# Structure
|
||||
mkdir -p python311-node20
|
||||
```
|
||||
|
||||
#### 2. انتقال Base Files
|
||||
|
||||
```bash
|
||||
# Copy base files
|
||||
cp ../landing/docker/Dockerfile.base python311-node20/Dockerfile
|
||||
cp ../landing/.woodpecker-base.yml .woodpecker.yml
|
||||
```
|
||||
|
||||
#### 3. Update Application Repository
|
||||
|
||||
در `peikarband/landing`:
|
||||
|
||||
```dockerfile
|
||||
# docker/Dockerfile
|
||||
ARG BASE_IMAGE=hub.peikarband.ir/peikarband/base:python311-node20
|
||||
FROM ${BASE_IMAGE} AS builder
|
||||
```
|
||||
|
||||
#### 4. Registry Organization
|
||||
|
||||
```
|
||||
Registry Structure:
|
||||
hub.peikarband.ir/
|
||||
├── peikarband/base # Base images repo
|
||||
│ ├── python311-node20:latest
|
||||
│ └── python312-node21:latest
|
||||
└── peikarband/landing # Application
|
||||
└── latest
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## زمان جداسازی
|
||||
|
||||
**جدا کنید وقتی:**
|
||||
- ✅ 3+ پروژه از همان base استفاده میکنند
|
||||
- ✅ تیم 5+ نفری دارید
|
||||
- ✅ Base versioning پیچیده شد
|
||||
- ✅ نیاز به CI/CD مستقل برای base دارید
|
||||
|
||||
**جدا نکنید وقتی:**
|
||||
- ❌ فقط یک پروژه دارید (فعلی)
|
||||
- ❌ تیم کوچک است (1-3 نفر)
|
||||
- ❌ Base خیلی تغییر نمیکند
|
||||
|
||||
---
|
||||
|
||||
## توصیه
|
||||
|
||||
**الان:** یک repository کافیه! 👍
|
||||
|
||||
**آینده:** اگر پروژه دوم شروع شد، مجدداً ارزیابی کنید.
|
||||
Reference in New Issue
Block a user