FROM mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm

# Install pnpm globally as root, then make available to the node user
RUN corepack enable && corepack prepare pnpm@latest --activate

# Switch to non-root user (provided by base image)
USER node

# Pre-create pnpm store directory for cache mounting later if desired
RUN mkdir -p /home/node/.local/share/pnpm
ENV PNPM_HOME=/home/node/.local/share/pnpm
ENV PATH=$PNPM_HOME:$PATH
