Files
crop-chem-docs/Dockerfile
T
justin a97107de46
Image rebuild (skip scrape) / build (push) Failing after 1h37m12s
docker: production image + Gitea Actions for monthly refresh
Dockerfile: self-contained image with corpus + Chroma + BM25 baked
in. Drawbar's compose pulls + runs without volume mounts. Built from
sources.json (labels schema), PRODUCT_NAME=crop_chem by default,
HYBRID_SEARCH=true (always-on for production quality). RERANK_URL +
OLLAMA_URL get set at compose time.

.gitea/workflows/refresh.yml: monthly cron (1st @ 06:00 UTC) does
full scrape → reindex → image push. Scrapes Bayer (~30 min) +
EPA PPLS row-crop filtered (~7h). Skips reindex+push if no corpus
diff. Tags pushed: :latest, :<sha12>, :corpus-<YYYY.MM.DD>.

.gitea/workflows/image-only.yml: on-demand or auto on code-only
pushes to main (paths: docs_mcp/, rag/, scrape/, requirements.txt,
Dockerfile, sources.json). Reindexes from committed corpus, builds
image, pushes. ~10 min vs ~9h full refresh.

.gitignore: corpus/ now COMMITTED (4,159 labels, 265 MB of .md +
sidecars). Lets image-only.yml rebuild indexes without re-scraping.
chroma/ + bm25/ still gitignored (regenerable binary indexes).

.dockerignore: drops venv, eval results, PLAN/README/CLAUDE.md,
deploy/, .git/ — keeps the image lean. corpus + chroma + bm25
explicitly NOT in dockerignore (those go INTO the image).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 12:32:41 -04:00

56 lines
1.8 KiB
Docker

# crop-chem-docs MCP server — production image.
#
# Structure: copy code first, then the regenerable indexes last so a
# code-only change doesn't invalidate the corpus COPY layer.
#
# The container runs the MCP server via streamable-http on PORT 8000.
# Override via MCP_HOST / MCP_PORT env if you front it with a different
# reverse-proxy setup.
#
# Image is self-contained — corpus, Chroma collection, and BM25 db are
# all baked in. Drawbar's docker-compose pulls the image and runs it;
# no host volume mounts required for serve.
#
# RERANK_URL is set at compose time (points at the llama.cpp sidecar
# on trashpanda's Tesla P4). OLLAMA_URL is set at compose time too
# (the embed-pool of Ollama instances). Defaults are commented inline.
FROM python:3.12-slim
WORKDIR /app
# Install Python deps first for cacheability.
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Code.
COPY scrape /app/scrape
COPY rag /app/rag
COPY docs_mcp /app/docs_mcp
# Source catalog. Lists the corpus sources (Bayer + EPA PPLS today).
COPY sources.json /app/
# Regenerable indexes. CI builds these from corpus/ in the same job
# that builds the image. Listed last so code changes don't invalidate
# the COPY layer cache for these (much larger) directories.
#
# bm25/ is only consulted when HYBRID_SEARCH=true (the server falls
# back to dense-only if it's missing).
COPY corpus /app/corpus
COPY chroma /app/chroma
COPY bm25 /app/bm25
ENV PYTHONUNBUFFERED=1 \
PRODUCT_NAME=crop_chem \
MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 \
MCP_PORT=8000 \
HYBRID_SEARCH=true
# RERANK_URL set at deploy time, e.g. http://llama-rerank:8080
# OLLAMA_URL set at deploy time, comma-separated list
EXPOSE 8000
ENTRYPOINT ["python", "-m", "docs_mcp.server"]