feat: tsx

This commit is contained in:
陶林 2025-06-19 11:30:30 +08:00
parent 63817a52e8
commit 842f23b762

View File

@ -1,6 +1,3 @@
# ABOUTME: Docker image for Claude Code with Twilio MCP server
# ABOUTME: Provides autonomous Claude Code environment with SMS notifications
FROM node:20-slim
# Install required system dependencies
@ -26,15 +23,18 @@ fi
# Create a non-root user with matching host UID/GID
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g $USER_GID claude-user && \
useradd -m -s /bin/bash -u $USER_UID -g $USER_GID claude-user && \
echo "claude-user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN addgroup --gid $USER_GID claude-user || true && \
adduser --disabled-password --gecos '' --uid $USER_UID --gid $USER_GID claude-user && \
echo "claude-user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
echo "User created:" && id claude-user && groups claude-user
# Create app directory
WORKDIR /app
# Install Claude Code globally
RUN npm install -g @anthropic-ai/claude-code
RUN npm install -g tsx
RUN npm install -g nrm
# Ensure npm global bin is in PATH
ENV PATH="/usr/local/bin:${PATH}"
@ -64,7 +64,8 @@ RUN cp /tmp/.claude.json /home/claude-user/.claude.json && \
rm -rf /tmp/.claude*
# Set proper ownership for everything
RUN chown -R claude-user:claude-user /app /home/claude-user
RUN chown -R claude-user:claude-user /app /home/claude-user || \
chown -R $(id -u claude-user):$(id -g claude-user) /app /home/claude-user
# Switch to non-root user
USER claude-user
@ -82,6 +83,7 @@ RUN bash -c 'source /app/.env && \
echo "No Twilio credentials found, skipping MCP configuration"; \
fi'
# Configure git user during build using host git config passed as build args
ARG GIT_USER_NAME=""
ARG GIT_USER_EMAIL=""