-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.worker
More file actions
38 lines (25 loc) · 936 Bytes
/
Dockerfile.worker
File metadata and controls
38 lines (25 loc) · 936 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
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
# Install only production dependencies
RUN npm ci --omit=dev
# ─── Production Image ─────────────────────────────────────────
FROM node:20-alpine AS production
# Security: run as non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Install wget for consistency and debugging
RUN apk add --no-cache wget
WORKDIR /app
# Copy package.json first — needed so Node knows this is an ESM package ("type": "module")
COPY package*.json ./
# Copy production dependencies from builder stage
COPY --from=builder /app/node_modules ./node_modules
# Copy application source
COPY src ./src
COPY worker.js ./
COPY config ./config
COPY templates ./templates
# Set ownership to non-root user
RUN chown -R appuser:appgroup /app
USER appuser
CMD ["node", "worker.js"]