Files
jbrechtel 460b7d0fdc
Build and Deploy / build-and-deploy (push) Successful in 2m43s
Store cook log DB in writable data dir, not read-only recipes mount
The cook log SQLite DB was created at recipeDir/cook-log.db. In the Docker
deployment /recipes is mounted read-only, so SQLite could never create the
file there — the cook log has never worked in the container. The writable
/data volume was mounted but unused.

- initDb now creates the DB's parent directory if missing, so startup
  initialization is self-contained and idempotent.
- app takes a dataDir and places cook-log.db there.
- Add optional --data-dir flag (defaults to the recipe dir, preserving
  local-dev behavior); Docker CMD passes --data-dir /data.

Verified end-to-end as root against a read-only recipe dir and a
non-existent data dir: the dir and DB are created and cook-log POST/GET
round-trips.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 21:53:35 -04:00

38 lines
1.6 KiB
Docker

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl python3 python3-pip python3-venv tini && \
rm -rf /var/lib/apt/lists/*
# Install recipe-scrapers, Playwright, and Anthropic SDK in a virtualenv to isolate dependencies.
RUN python3 -m venv /opt/roux-venv && \
/opt/roux-venv/bin/pip install --no-cache-dir recipe-scrapers==15.11.0 playwright==1.52.0 anthropic pyyaml && \
rm -rf /root/.cache/pip
# Install Playwright system dependencies and Chromium browser.
RUN /opt/roux-venv/bin/playwright install-deps chromium && \
/opt/roux-venv/bin/playwright install chromium
# Build timestamp — read at runtime for diagnostics.
RUN mkdir -p /build && date -u '+%Y-%m-%d %H:%M UTC' > /build/build-time
ADD roux-server /usr/local/bin/roux-server
ADD scripts/scrape-recipe /usr/local/bin/scrape-recipe
ADD scripts/convert-to-cooklang /usr/local/bin/convert-to-cooklang
ADD prompts /usr/local/share/roux/prompts/
RUN chmod +x /usr/local/bin/roux-server /usr/local/bin/scrape-recipe /usr/local/bin/convert-to-cooklang
ENV PATH="/opt/roux-venv/bin:${PATH}"
ENTRYPOINT ["/usr/bin/tini", "-s", "--"]
# Recipes are mounted at /recipes at runtime via docker-compose volume mount.
RUN mkdir /recipes
WORKDIR /recipes
EXPOSE 8080
# The cook log DB is written to /data (a writable volume); /recipes is mounted
# read-only, so the DB cannot live there.
CMD ["/usr/local/bin/roux-server", "--host", "0.0.0.0", "--config-file", "/roux/config.yaml", "--port", "8080", "--recipe-dir", "/recipes", "--data-dir", "/data"]