FROM node:20-bookworm
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
    && rm -rf /var/lib/apt/lists/* \
    && npm install -g @anthropic-ai/claude-code
WORKDIR /srv
COPY server.js .
# claude refuses --dangerously-skip-permissions as root: run as the node
# user (uid 1000, matches typical host ownership of the mounted ~/.claude)
RUN mkdir -p /work && chown node:node /work /srv
USER node
ENV HOME=/home/node
EXPOSE 8091
CMD ["node", "server.js"]
