FROM node:22-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    openssh-client \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

RUN npm install -g @anthropic-ai/claude-code

WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY src ./src

RUN git config --global user.email "claude-agent@apps.williamturner.eu" \
    && git config --global user.name "claude-agent" \
    && git config --global --add safe.directory '*'

ENV NODE_ENV=production
EXPOSE 3001
CMD ["node", "src/server.js"]
