The notebook `mo.ui.altair_chart()` wrapper crashed on our multi-field `tooltip=[...]` encodings — `'list' object has no attribute 'get'` from marimo's `_get_binned_fields`, which pre-0.23 didn't guard against list-valued encoding channels (fixed upstream with `if isinstance(encoding, list): continue`). The notebook's altair args were correct all along; the pinned marimo was just stale (the Python package pinned 0.20.4 while the notebooks image already built 0.23.1). Bump the Python pin to the latest 0.23.13 and align the image `MARIMO_VERSION` ARG. Verified: the resolved marimo has the list guard, `mo.ui.altair_chart` with a multi-field tooltip builds, the notebook loads, and bib.ui (the only src/ marimo consumer) passes its 843 tests. No notebook changes needed.
127 lines
4.7 KiB
Docker
127 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.
|
|
|
|
# renovate: datasource=github-tags depName=marimo-team/marimo extractVersion=^v?(?<version>.+)$
|
|
ARG MARIMO_VERSION=0.23.13
|
|
|
|
# ---- 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"]
|