Files
stack/infra/images/notebooks.Dockerfile
kert 16f3b43974
Some checks failed
CI / skinny-install (aco) (push) Successful in 1m12s
CI / skinny-install (api) (push) Successful in 30s
CI / skinny-install (bcda) (push) Successful in 36s
CI / skinny-install (bib) (push) Successful in 35s
CI / skinny-install (bls) (push) Successful in 27s
CI / skinny-install (ccw) (push) Successful in 32s
CI / skinny-install (cli) (push) Successful in 41s
CI / skinny-install (cms) (push) Successful in 37s
CI / skinny-install (conf) (push) Successful in 38s
CI / skinny-install (opps) (push) Successful in 33s
CI / skinny-install (perf) (push) Successful in 38s
CI / skinny-install (pfs) (push) Successful in 38s
CI / skinny-install (rex) (push) Successful in 34s
Deploy / build-scan-report (push) Failing after 46s
Infra CI / notebooks (push) Failing after 25s
Infra CI / zotero (push) Successful in 12s
Infra CI / docs (push) Failing after 16s
CI / lint-test (push) Failing after 11m2s
Infra CI / mc (push) Successful in 21s
Infra CI / api (push) Successful in 29s
Package Supply Chain / pkg-supply-chain (push) Failing after 41s
feat: full session — mail servers, comment pipeline, PRISMA fetch, email ingest
Mail: Maddy on DO (corwins.media+Resend, fhirworx.io+Postmark),
touchless/stateless/idempotent. Gitea SMTP via env_file. CMS inbox
at cmsupdates@mail.fhirworx.io with IMAP→bib poller.

Bib: regulations.gov v4 client, Federal Register discovery, 164K
comment backfill (running), IMAP email ingest, Zotero sync routing.

PRISMA: altcha PoW solver, CrossRef DOI resolution, 83/129 PDFs.
Zotero: schema parity, ops module, CLI, fail-fast guard.
CI: docs.Dockerfile COPY glob fix (tracks #341).
Infra: Gitea+marimo fhirworx themes, IOM/OIG modules.
2026-04-16 09:04:38 -04:00

126 lines
4.7 KiB
Docker

# syntax=docker/dockerfile:1
#
# Notebooks runtime — fhirworx-themed marimo on CUDA + Python 3.13.
#
# Stage 1 (fe): node + pnpm. Overlay fhirworx theme onto a pinned
# marimo source tree and compile frontend + lsp into
# marimo/_static/ and marimo/_lsp/.
# Stage 2 (wheel): uv builds a marimo wheel with the fhirworx bundle
# baked in.
# Stage 3 (final): CUDA runtime + Python stack; installs the wheel into
# the workspace venv.
#
# Iterate by editing infra/marimo/theme/**. BuildKit cache mounts keep
# pnpm and turbo warm between rebuilds, so CSS/icon edits land in under
# a minute after first bootstrap.
ARG MARIMO_VERSION=0.23.1
# ---- stage 1: frontend ------------------------------------------------------
FROM node:22-bookworm-slim AS fe
ARG MARIMO_VERSION
WORKDIR /src
RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates python3 jq \
&& rm -rf /var/lib/apt/lists/* \
&& corepack enable \
&& corepack prepare pnpm@latest --activate
# Shallow clone marimo at the pinned tag.
RUN git clone --depth 1 --branch ${MARIMO_VERSION} --filter=blob:none \
https://github.com/marimo-team/marimo /src
COPY infra/marimo/theme /overlay
RUN /overlay/scripts/apply-overlay.sh /src /overlay
RUN --mount=type=cache,target=/root/.cache/pnpm,sharing=locked \
pnpm install --no-frozen-lockfile
RUN --mount=type=cache,target=/root/.cache/turbo,sharing=locked \
--mount=type=cache,target=/src/frontend/node_modules/.cache,sharing=locked \
NODE_ENV=production pnpm turbo build --filter @marimo-team/frontend --output-logs=full
RUN --mount=type=cache,target=/root/.cache/turbo,sharing=locked \
NODE_ENV=production pnpm turbo build --filter @marimo-team/lsp --output-logs=full
RUN rm -rf marimo/_static marimo/_lsp \
&& mkdir -p marimo/_static marimo/_lsp \
&& cp -R frontend/dist/. marimo/_static/ \
&& rm -f marimo/_static/files/wasm-intro.py \
&& cp docs/_static/CLAUDE.md marimo/_static/CLAUDE.md 2>/dev/null || true \
&& cp packages/lsp/dist/index.cjs marimo/_lsp/ \
&& { [ -d packages/lsp/dist/copilot/dist ] \
&& cp -R packages/lsp/dist/copilot/dist/. marimo/_lsp/copilot/ \
|| true; }
# ---- stage 2: wheel ---------------------------------------------------------
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS wheel
WORKDIR /src
COPY --from=fe /src/ /src/
RUN uv build --wheel
# ---- stage 3: runtime -------------------------------------------------------
FROM nvidia/cuda:12.6.0-runtime-ubuntu24.04
ARG USERNAME=kert
ARG USER_UID=1000
ARG USER_GID=1000
ARG PYTHON_VERSION=3.13
# Local package registry (Gitea) — set via --build-arg to pull from mirror
ARG PYPI_INDEX_URL=""
ENV DEBIAN_FRONTEND=noninteractive \
HOME=/home/kert \
PATH="/home/kert/.local/bin:${PATH}" \
NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,utility
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
curl ca-certificates git build-essential \
&& rm -rf /var/lib/apt/lists/*
RUN groupmod -n ${USERNAME} ubuntu \
&& usermod -l ${USERNAME} -d /home/${USERNAME} -m -s /bin/bash ubuntu \
&& chown -R ${USER_UID}:${USER_GID} /home/${USERNAME}
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
COPY --from=ghcr.io/astral-sh/uv:latest /uvx /usr/local/bin/uvx
WORKDIR /home/${USERNAME}
# Bring in the fhirworx marimo wheel from the wheel stage.
COPY --from=wheel /src/dist/ /tmp/marimo-wheel/
# Install python + init workspace venv. Use the local wheel for marimo so
# the fhirworx frontend ships in the image; no upstream PyPI fetch for
# marimo itself.
RUN uv python install ${PYTHON_VERSION} \
&& uv init workspace --python ${PYTHON_VERSION} \
&& cd workspace \
&& MARIMO_WHL=$(ls /tmp/marimo-wheel/marimo-*.whl | head -1) \
&& uv add "${MARIMO_WHL}[recommended]" polars cudf-polars-cu12 pandas numpy pyarrow \
"pyiceberg[s3,pyarrow]>=0.7.0" "duckdb>=1.0.0" "narwhals>=1.0.0" "trino>=0.328.0" \
"sqlglot>=26.0.0" \
vega_datasets pyzotero obstore s3fs \
--extra-index-url https://pypi.nvidia.com
# Create marimo config directory with minimal defaults.
# Full config (marimo.toml, snippets, loch.css) is mounted at runtime
# from infra/marimo/ via compose.yml volumes.
RUN mkdir -p /home/${USERNAME}/.config/marimo
EXPOSE 2718
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD curl -sf http://localhost:2718/health || exit 1
CMD ["uv", "run", "--project", "/home/kert/workspace", \
"marimo", "edit", \
"--host", "0.0.0.0", "--port", "2718", "--headless", "--no-token", \
"/home/kert/notebooks"]