# Build context is the repo root (see docker-compose.yml) so the sibling # packages Core/, Persistance/, Extraction/ and models/ # can be copied, and Transformation/ compiled. # dbt's manifest: the measures' definitions and the compiled SQL of their event # models. The API serves the measures from it and the indicator cycle creates # the views. Compiling needs no data; the SQL is SQLite's, the image's default # engine. FROM python:3.12-slim AS manifest COPY --from=ghcr.io/astral-sh/uv:0.7.9 /uv /uvx /bin/ WORKDIR /app/Transformation COPY Transformation/ ./ RUN uv sync && uv run --no-sync dbt compile --profiles-dir . --profile tea FROM python:3.12-slim # Tesseract (with Spanish data) for scanned documents; pytesseract only wraps the binary. RUN apt-get update && apt-get install -y --no-install-recommends \ tesseract-ocr tesseract-ocr-spa \ && rm -rf /var/lib/apt/lists/* COPY --from=ghcr.io/astral-sh/uv:0.7.9 /uv /uvx /bin/ WORKDIR /app COPY Core/ Core/ COPY Persistance/ Persistance/ COPY Extraction/ Extraction/ COPY models/ models/ COPY WebApi/ WebApi/ # One environment for the API, the migrations and the indicator cycle. The SQL # drivers serve both the import sources and *_DATABASE_URL on MySQL/PostgreSQL/SQL Server. RUN cd WebApi && uv sync --locked --no-dev --extra sql-drivers ENV CACU_DATABASE_URL=sqlite:////data/cacu.db ENV CAMA_DATABASE_URL=sqlite:////data/cama.db ENV TEA_DATABASE_URL=sqlite:////data/tea.db ENV GOVERNANCE_DATABASE_URL=sqlite:////data/governance.db # MLflow model registry and artifacts, next to the databases so backups cover them. ENV MLFLOW_TRACKING_URI=sqlite:////data/mlflow.db ENV MLFLOW_ARTIFACT_ROOT=/data/mlflow-artefactos # No usage telemetry from MLflow: the server runs on a closed network. ENV MLFLOW_DISABLE_TELEMETRY=true DO_NOT_TRACK=true # Aggregate import log and the live indicator queue (webapi.recomputation). ENV WEBAPI_REPORT_DIR=/data/reportes ENV INDICADORES_DIR=/data/indicadores ENV MLFLOW_DISABLE_AGENT_HINT=1 # Without it the measure routes (//indicadores, //fhir) aren't # registered. On another engine, mount a manifest compiled with that dbt target # and point this at it. COPY --from=manifest /app/Transformation/target/manifest.json /app/Transformation/target/manifest.json ENV DBT_MANIFEST=/app/Transformation/target/manifest.json RUN chmod +x /app/WebApi/docker-entrypoint.sh EXPOSE 5000 ENTRYPOINT ["/app/WebApi/docker-entrypoint.sh"]