mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
fd6427a282
(Re-applied cleanly on top of main: PR #18 was rebase-merged, so the branch that became #19 conflicted on the already-landed commits. This carries ONLY the librarian state fix - the sole content difference between that branch and main - so nothing else is touched or lost.) The worker threads open cr_results/rr_results/not_in_db/s_results.json in place ('r+'), crashing with FileNotFoundError in a fresh container. New conjurer_librarian/lib_paths.py resolves all four under a persistent dir (CONJURER_LIBRARIAN_STATE_DIR, default /lib_temp_files) and seeds missing ones with '{}' on import; shared by conjurer_librarian.py and scrape_bot.py (no circular import). ndb_database/database initialised to {} before load so a corrupt persisted file degrades to empty instead of NameError. search_bot /search_bot2 open the DOI DB 'r' not 'r+' so /doi can stay read-only. Docker: STATE_DIR env + VOLUME, compose mounts /srv/librarian/state:/lib_temp_files. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
1.0 KiB
Docker
31 lines
1.0 KiB
Docker
# Conjurer librarian (Crossref search + local DOI database lookup).
|
|
# Build from the repository root:
|
|
# docker build -f docker/Dockerfile.librarian -t conjurer-librarian .
|
|
FROM python:3.11-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY conjurer_librarian/requirements_librarian.txt ./
|
|
RUN pip install --no-cache-dir --upgrade pip \
|
|
&& pip install --no-cache-dir -r requirements_librarian.txt requests
|
|
|
|
COPY conjurer_librarian/ ./
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
CONJURER_LIBRARIAN_HOST=0.0.0.0 \
|
|
CONJURER_LIBRARIAN_PORT=5001 \
|
|
CONJURER_LIBRARIAN_DB_PATH=/doi/ \
|
|
CONJURER_LIBRARIAN_STATE_DIR=/lib_temp_files
|
|
|
|
# /doi = the local DOI chunk database (large, read-only).
|
|
# /lib_temp_files = runtime JSON state (cr_results/rr_results/not_in_db/
|
|
# s_results) - seeded on first run, persisted across restarts.
|
|
VOLUME ["/doi", "/lib_temp_files"]
|
|
EXPOSE 5001
|
|
|
|
CMD ["python", "conjurer_librarian.py"]
|