-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (21 loc) · 945 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (21 loc) · 945 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
# ─── Build stage ──────────────────────────────────────────────────
FROM node:24-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
# ─── Runtime stage ───────────────────────────────────────────────
FROM node:24-alpine
WORKDIR /app
# Security: run as non-root
RUN addgroup -g 1001 -S appgroup && \
adduser -u 1001 -S appuser -G appgroup
COPY --from=builder /app/node_modules ./node_modules
COPY server.js ./
# Drop privileges
USER appuser
EXPOSE 8080
ENV PORT=8080
ENV TARGET_HOST=http://localhost:3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/healthz || exit 1
CMD ["node", "server.js"]