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