feat: user node user for all the operations instead of root

This commit is contained in:
2025-10-23 17:35:29 +05:30
parent e7c48d53c6
commit 76e753b0bb
2 changed files with 21 additions and 16 deletions

View File

@@ -1,14 +1,18 @@
FROM node:22-alpine
WORKDIR /app
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH=$NPM_CONFIG_PREFIX/bin:$PATH
ENV NODE_ENV=production
ENV CLAUDE_CONFIG_DIR=/home/node/.claude
USER node
WORKDIR /home/node/app
RUN npm install -g @anthropic-ai/claude-code
RUN apk add --no-cache bash
ENV NODE_ENV=production
ENV CLAUDE_CONFIG_DIR=/root/.claude
# Ensure config directory exists
RUN mkdir -p $CLAUDE_CONFIG_DIR
ENTRYPOINT ["/bin/bash", "-c", "claude; exec /bin/bash"]
# Since we destroy the container after exiting, claude code never gets updated.
# Updating at the start making sure its up to date.
ENTRYPOINT ["/bin/sh", "-c", "npm update -g @anthropic-ai/claude-code; claude; exec /bin/sh"]