RAG servisi altyapisi - Containerfile/compose/.containerignore
Browse files at this commit3a4dda104716bb87a8fe13330058bc9c72586fedParent: 7a1f83f- chore
- RAG servisi altyapisi - Containerfile/compose/.containerignore
3 changed files +69 -0
- .containerignore +13 -0
- Containerfile +23 -0
- compose.yaml +33 -0
.containerignoreadded+13 -0
| @@ -0,0 +1,13 @@ | |||
| 1 | +# Podman build bağlamı dışı (imgeye girmez) | ||
| 2 | +.venv/ | ||
| 3 | +venv/ | ||
| 4 | +data/ | ||
| 5 | +eba_dl/ | ||
| 6 | +mockdata/ | ||
| 7 | +docs/ | ||
| 8 | +__pycache__/ | ||
| 9 | +*.py[cod] | ||
| 10 | +.pytest_cache/ | ||
| 11 | +.git/ | ||
| 12 | +.gitignore | ||
| 13 | +*.md | ||
Containerfileadded+23 -0
| @@ -0,0 +1,23 @@ | |||
| 1 | +# hezarfen_rag — RAG servisi konteyneri (Podman; Docker DEĞİL) | ||
| 2 | +# Not: Servis girişi (QUIC api-read) Faz 1 sonrası eklenecek; bu imge altyapı | ||
| 3 | +# hazırlığıdır (bağımlılıklar + hazırlık kontrolü). | ||
| 4 | +FROM docker.io/library/python:3.11-slim | ||
| 5 | + | ||
| 6 | +WORKDIR /app | ||
| 7 | + | ||
| 8 | +# Konteynerde CPU torch (yerel geliştirmede GPU/cu124 kullanılır; GPU passthrough | ||
| 9 | +# ayrı kurulum ister). requirements'taki torch>=2.6 bu CPU wheel ile karşılanır, | ||
| 10 | +# cu124 tekrar indirilmez. | ||
| 11 | +COPY requirements.txt . | ||
| 12 | +RUN pip install --no-cache-dir torch>=2.6 --index-url https://download.pytorch.org/whl/cpu \ | ||
| 13 | + && pip install --no-cache-dir -r requirements.txt | ||
| 14 | + | ||
| 15 | +COPY src ./src | ||
| 16 | +COPY tests ./tests | ||
| 17 | + | ||
| 18 | +# BGE-M3 modeli ilk çalıştırmada indirilir → HF_HOME kalıcı volume'a bağlanır. | ||
| 19 | +ENV HF_HOME=/models \ | ||
| 20 | + PYTHONUNBUFFERED=1 | ||
| 21 | + | ||
| 22 | +# Servis girişi henüz yok. Hazırlık kontrolü (import + sürüm). | ||
| 23 | +CMD ["python", "-c", "import src; print('hezarfen_rag hazir — RAG servis girisi Faz 1 sonrasi eklenecek')"] | ||
compose.yamladded+33 -0
| @@ -0,0 +1,33 @@ | |||
| 1 | +# hezarfen_rag — proje-bazlı Podman compose (Docker DEĞİL). | ||
| 2 | +# Kardeş servisler (backend/frontend/chatbot) kendi compose'larıyla ayağa kalkar. | ||
| 3 | +# RAG, backend'in paylaşılan ağına (hezarfen_backend_default) bağlanır — Çelebi | ||
| 4 | +# köprüsüyle aynı desen. Servis girişi Faz 1 sonrası (QUIC api-read) eklenecek. | ||
| 5 | +# | ||
| 6 | +# Kullanım (backend ayaktayken): | ||
| 7 | +# podman compose --profile product up -d --build | ||
| 8 | +services: | ||
| 9 | + rag: | ||
| 10 | + build: | ||
| 11 | + context: . | ||
| 12 | + dockerfile: Containerfile | ||
| 13 | + image: localhost/hezarfen-rag:local | ||
| 14 | + container_name: hezarfen-rag | ||
| 15 | + profiles: ["product"] # otomatik kalkmaz; backend hazır olunca çalıştır | ||
| 16 | + environment: | ||
| 17 | + DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-} # üretim adımı (Faz 1.7) için | ||
| 18 | + HF_HOME: /models # BGE-M3 model cache | ||
| 19 | + PYTHONUNBUFFERED: "1" | ||
| 20 | + volumes: | ||
| 21 | + - rag-models:/models # model cache kalıcı (BGE-M3 ~2GB) | ||
| 22 | + # - ./data:/app/data:ro # ölçüm verisi (opsiyonel; git-ignored) | ||
| 23 | + networks: | ||
| 24 | + - backend_net | ||
| 25 | + restart: unless-stopped | ||
| 26 | + | ||
| 27 | +networks: | ||
| 28 | + backend_net: | ||
| 29 | + external: true | ||
| 30 | + name: hezarfen_backend_default | ||
| 31 | + | ||
| 32 | +volumes: | ||
| 33 | + rag-models: | ||