# Routemark recipe: node. A project kind, as text: Node with npm and pnpm, and no Python tools.
#
# Routemark ships this file and never an image. You build it on your own machine with your own `docker build`
# (the README beside this file gives the command), and a project whose `routemark.toml` says
# `containment = "image"` runs its delegate and its checks in a container from what you built.
#
# The tools are pinned exactly, each by its version (the README's table says which). The Debian packages are
# pinned by the base image's Debian release alone: what it ships on the day of the build, its fixes included.
#
# What it holds, and why:
# - node:22.23.4-trixie-slim: Debian 13 with Node 22, npm and npx.
# - OpenCode and pnpm from npm, by version.
# - No uv: an MCP server started with `uvx` does not run inside (the README says how to add it).
# - No compilers: a dependency that builds native code at install fails here; add build-essential to the apt-get
#   line below if yours does.

FROM node:22.23.4-trixie-slim

ARG OPENCODE_VERSION=2.1.3
ARG PNPM_VERSION=10.32.1

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates curl git \
    && rm -rf /var/lib/apt/lists/*

RUN npm install -g "@opencode/cli@${OPENCODE_VERSION}" "pnpm@${PNPM_VERSION}" \
    && npm cache clean --force

# The delegate's home is private to one run: Routemark mounts an empty folder of the run's here, and the
# harness's own settings read-only inside it. The four XDG folders are pinned under it so the harness keeps its
# state there and nowhere else.
ENV HOME=/home/delegate \
    XDG_CONFIG_HOME=/home/delegate/.config \
    XDG_DATA_HOME=/home/delegate/.local/share \
    XDG_CACHE_HOME=/home/delegate/.cache \
    XDG_STATE_HOME=/home/delegate/.local/state \
    OPENCODE_DISABLE_AUTOUPDATE=1

RUN mkdir -p /home/delegate /work

# The run's copy of the project is mounted here, read-write.
WORKDIR /work
