File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,11 +52,6 @@ RUN ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') && \
5252 chmod +x /usr/local/bin/gh && \
5353 rm -rf /tmp/gh*
5454
55- # Install Claude CLI
56- # Install the official Claude CLI from npm
57- RUN npm install -g @anthropic-ai/claude-code || \
58- echo "Warning: Claude CLI installation failed. Please install manually or ensure API access is configured."
59-
6055# Create app user and group
6156RUN addgroup -g 1001 -S appgroup && \
6257 adduser -S appuser -u 1001 -G appgroup && \
@@ -90,6 +85,19 @@ RUN mkdir -p /workspace && \
9085# Switch to non-root user
9186USER appuser
9287
88+ # Configure npm global directory for non-root user
89+ RUN mkdir -p /home/appuser/.npm-global && \
90+ npm config set prefix '/home/appuser/.npm-global'
91+
92+ # Set npm global path in environment
93+ ENV PATH="/home/appuser/.npm-global/bin:${PATH}"
94+ ENV NPM_CONFIG_PREFIX="/home/appuser/.npm-global"
95+
96+ # Install Claude CLI
97+ # Install the official Claude CLI from npm (now can be updated without root)
98+ RUN npm install -g @anthropic-ai/claude-code || \
99+ echo "Warning: Claude CLI installation failed. Please install manually or ensure API access is configured."
100+
93101# Set environment variables
94102ENV NODE_ENV=production
95103ENV WORKSPACE_DIR=/workspace
Original file line number Diff line number Diff line change @@ -60,11 +60,6 @@ RUN ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') && \
6060 chmod +x /usr/local/bin/gh && \
6161 rm -rf /tmp/gh*
6262
63- # Install Claude CLI
64- # Install the official Claude CLI from npm
65- RUN npm install -g @anthropic-ai/claude-code || \
66- echo "Warning: Claude CLI installation failed. Please install manually or ensure API access is configured."
67-
6863# Create app user and group
6964RUN addgroup -g 1001 -S appgroup && \
7065 adduser -S appuser -u 1001 -G appgroup && \
@@ -98,6 +93,19 @@ RUN mkdir -p /workspace && \
9893# Switch to non-root user
9994USER appuser
10095
96+ # Configure npm global directory for non-root user
97+ RUN mkdir -p /home/appuser/.npm-global && \
98+ npm config set prefix '/home/appuser/.npm-global'
99+
100+ # Set npm global path in environment
101+ ENV PATH="/home/appuser/.npm-global/bin:${PATH}"
102+ ENV NPM_CONFIG_PREFIX="/home/appuser/.npm-global"
103+
104+ # Install Claude CLI
105+ # Install the official Claude CLI from npm (now can be updated without root)
106+ RUN npm install -g @anthropic-ai/claude-code || \
107+ echo "Warning: Claude CLI installation failed. Please install manually or ensure API access is configured."
108+
101109# Set environment variables
102110ENV NODE_ENV=production
103111ENV WORKSPACE_DIR=/workspace
You can’t perform that action at this time.
0 commit comments