# XRF visualizer — CPU-only JAX runtime. NOT TESTED (see README.md).
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

WORKDIR /app
COPY pyproject.toml uv.lock README.md ./
RUN uv sync --frozen --no-dev
COPY src/ ./src/
COPY tests/ ./tests/

# Cube path is optional (M6): with XRF_CUBE set the cube loads at startup,
# otherwise the app starts empty and the user uploads a file or pastes a
# link in the UI. Bind-mount the data dir read-only at /data when using it.
EXPOSE 8765
CMD ["uv", "run", "python", "-c", "import os; from xrf_visualizer.data import load_cube; from xrf_visualizer.ui import build_app; p = os.environ.get('XRF_CUBE') or None; build_app(load_cube(p).array if p else None).run(host='0.0.0.0', port=8765)"]