-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 795 Bytes
/
Dockerfile
File metadata and controls
31 lines (22 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Generated by https://smithery.ai. See: https://smithery.ai/docs/build/project-config
FROM node:lts-alpine
# Create app directory
WORKDIR /app
# Copy package definition and tsconfig first for dependencies
COPY package.json tsconfig.json ./
# Install dependencies without running prepare scripts
RUN npm install --ignore-scripts
# Copy source and build
COPY . .
RUN npm run build
# Create non-root user for security (fixes CVE-2019-5736 and OWASP Rule #2)
RUN addgroup -g 1001 -S nodejs && \
adduser -S coderide -u 1001 -G nodejs
# Change ownership of app directory to non-root user
RUN chown -R coderide:nodejs /app
# Switch to non-root user
USER coderide
# Default environment
ENV NODE_ENV=production
# Use stdio entrypoint with non-root user
ENTRYPOINT ["node", "dist/index.js"]