Phase 1.7: Docker default REGION=kenya + CI region matrix
Browse files- Dockerfile: COPY the Kenya data JSONs (markets_kenya.json,
commodities_kenya.json, farmers_kenya.json) and data/ directory
(KAMIS demo snapshot + future cache) alongside the India files.
Set ENV MARKET_INTEL_REGION=kenya as the image default per Phase
11 product decision. Override at deploy time with
-e MARKET_INTEL_REGION=india for the Tamil Nadu config.
- CI backend job now runs as a matrix over [india, kenya] with
MARKET_INTEL_DEMO_MODE=1, executes pytest tests/ under each region.
Frontend job unchanged (region-agnostic).
- weekly-pipeline.yml unchanged: it triggers the HF Space via API
and the Space's own REGION env var determines which region it
ingests. If user wants Kenya on the HF Space, that's an HF secret
change (not a CI change) + an HF Space push — deferred until user
approves.
Does NOT: build Docker locally to verify (~5 min Chronos pre-cache);
user or CI will do that. Does NOT update the weekly-pipeline cron
time (currently 01:00 UTC = 06:30 IST; for Kenya prod use, 01:00 UTC
= 04:00 EAT — leaving as-is pending HF Space push).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- .github/workflows/ci.yml +10 -0
- Dockerfile +6 -0
|
@@ -9,6 +9,13 @@ on:
|
|
| 9 |
jobs:
|
| 10 |
backend:
|
| 11 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
steps:
|
| 13 |
- uses: actions/checkout@v4
|
| 14 |
|
|
@@ -22,6 +29,9 @@ jobs:
|
|
| 22 |
- name: Verify API loads
|
| 23 |
run: python -c "from src.api import app; print('API OK')"
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
frontend:
|
| 26 |
runs-on: ubuntu-latest
|
| 27 |
defaults:
|
|
|
|
| 9 |
jobs:
|
| 10 |
backend:
|
| 11 |
runs-on: ubuntu-latest
|
| 12 |
+
strategy:
|
| 13 |
+
fail-fast: false
|
| 14 |
+
matrix:
|
| 15 |
+
region: [india, kenya]
|
| 16 |
+
env:
|
| 17 |
+
MARKET_INTEL_REGION: ${{ matrix.region }}
|
| 18 |
+
MARKET_INTEL_DEMO_MODE: "1"
|
| 19 |
steps:
|
| 20 |
- uses: actions/checkout@v4
|
| 21 |
|
|
|
|
| 29 |
- name: Verify API loads
|
| 30 |
run: python -c "from src.api import app; print('API OK')"
|
| 31 |
|
| 32 |
+
- name: Run test suite
|
| 33 |
+
run: python -m pytest tests/ -q
|
| 34 |
+
|
| 35 |
frontend:
|
| 36 |
runs-on: ubuntu-latest
|
| 37 |
defaults:
|
|
@@ -28,11 +28,17 @@ USER root
|
|
| 28 |
COPY config.py .
|
| 29 |
COPY src/ src/
|
| 30 |
COPY markets.json commodities.json farmers.json ./
|
|
|
|
|
|
|
| 31 |
RUN mkdir -p models
|
| 32 |
RUN chown -R appuser:appuser /app
|
| 33 |
|
| 34 |
USER appuser
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
HEALTHCHECK --interval=30s --timeout=10s --retries=5 --start-period=60s \
|
|
|
|
| 28 |
COPY config.py .
|
| 29 |
COPY src/ src/
|
| 30 |
COPY markets.json commodities.json farmers.json ./
|
| 31 |
+
COPY markets_kenya.json commodities_kenya.json farmers_kenya.json ./
|
| 32 |
+
COPY data/ data/
|
| 33 |
RUN mkdir -p models
|
| 34 |
RUN chown -R appuser:appuser /app
|
| 35 |
|
| 36 |
USER appuser
|
| 37 |
|
| 38 |
+
# Default to Kenya per Phase 11 product decision. Override at deploy
|
| 39 |
+
# time with -e MARKET_INTEL_REGION=india to run the Tamil Nadu config.
|
| 40 |
+
ENV MARKET_INTEL_REGION=kenya
|
| 41 |
+
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
HEALTHCHECK --interval=30s --timeout=10s --retries=5 --start-period=60s \
|