- gateway: separate config, models, state, audit, guardrail, embeddings, store, metrics, cleanup and routes; keep main.py as FastAPI bootstrap - extension: split client/config, six tools, config command and rules; preserve jiti entrypoint and registrations - Dockerfile copies the complete gateway module set - tests: update monkeypatch boundaries for modular config/state
24 lines
785 B
Docker
24 lines
785 B
Docker
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Hash del commit Git da cui è costruita l'immagine (iniettato al build:
|
|
# docker compose build --build-arg GIT_COMMIT=$(git rev-parse HEAD) gateway
|
|
# o come args nel compose). Esposto da GET /v1/version e /v1/status.
|
|
ARG GIT_COMMIT=unknown
|
|
ENV GIT_COMMIT=$GIT_COMMIT
|
|
|
|
COPY . .
|
|
|
|
# Utente non-root con privilegi minimi (best practice container)
|
|
RUN useradd --create-home --uid 10001 appuser
|
|
USER appuser
|
|
|
|
# Pre-download del modello sparso BM25 (cache in /home/appuser/.cache/fastembed)
|
|
RUN python -c "from fastembed import SparseTextEmbedding; SparseTextEmbedding(model_name='Qdrant/bm25')"
|
|
|
|
EXPOSE 8080
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|