forked from Disciplr-Org/Disciplr-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (28 loc) · 763 Bytes
/
Copy pathDockerfile
File metadata and controls
42 lines (28 loc) · 763 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
32
33
34
35
36
37
38
39
40
41
42
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache python3 make g++ git
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy source and build
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
# Install minimal runtime deps (curl used by healthcheck)
RUN apk add --no-cache curl
# Copy package manifest and built artifacts
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
# Install only production dependencies
RUN npm ci --omit=dev
# Ensure files are owned by the non-root user
RUN chown -R node:node /app
# Switch to non-root `node` user
USER node
ENV NODE_ENV=production
ENV PORT=3000
EXPOSE 3000
CMD ["npm", "start"]