-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (18 loc) · 810 Bytes
/
Dockerfile
File metadata and controls
31 lines (18 loc) · 810 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
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
# Install all dependencies (including dev dependencies) for building
RUN npm ci && npm cache clean --force
COPY . .
RUN npm run build
# Production stage: copies dist from builder stage, then only installs dependencies needed for production (non-dev)
FROM node:22-alpine AS production
WORKDIR /app
# Run as non-root user `node`, which is a default user provided by the node image
RUN chown node:node ./
USER node
COPY --from=builder --chown=node:node /app/dist ./dist
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Entrypoint is used here to allow signals (e.g. SIGTERM) to properly pass through to node process
ENTRYPOINT [ "node", "--enable-source-maps", "dist/main.js", "--config=/config/config.json" ]