FROM node:22-bookworm-slim

# Install git and ca-certificates required by openclaw's npm dependencies
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && rm -rf /var/lib/apt/lists/*

# Rewrite any SSH GitHub URLs to HTTPS so npm install works without SSH keys
RUN git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"

# Install openclaw from npm (same approach as the official docker-setup.sh)
RUN npm install -g openclaw@latest --loglevel=error

ENV HOME=/home/node
ENV TERM=xterm-256color

# Run as non-root node user (uid 1000), same as official image
USER node
WORKDIR /home/node
