FROM node:22-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    ca-certificates \
    git \
    ripgrep \
    bash \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user with a real home directory
RUN useradd -m -s /bin/bash -u 1001 coder

# Ensure ~/.local/bin is on PATH (where the native installer puts the binary)
ENV PATH="/home/coder/.local/bin:/home/coder/.claude/bin:${PATH}"

# Copy entrypoint (as root, then lock down)
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh

USER coder
WORKDIR /code

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["bash"]
