-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathDockerfile.worker
More file actions
48 lines (38 loc) · 1.79 KB
/
Dockerfile.worker
File metadata and controls
48 lines (38 loc) · 1.79 KB
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
43
44
45
46
47
48
# ─── Crypto Vision — Worker Dockerfile ────────────────────────
# Lightweight container for ingestion workers.
# Re-uses the same build as the main service but runs
# worker entry points instead of the API server.
#
# Usage:
# docker build -f Dockerfile.worker -t crypto-vision-worker .
# docker run --env-file .env crypto-vision-worker node dist/src/workers/ingest-market.js
# ─────────────────────────────────────────────────────────────
# ─── Stage 1: Install dependencies ────────────────────────────
FROM node:22-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --ignore-scripts
# ─── Stage 2: Build TypeScript ────────────────────────────────
FROM node:22-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY tsconfig.json ./
COPY package*.json ./
COPY src/ src/
RUN npm run build
# ─── Stage 3: Production ─────────────────────────────────────
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Production deps only (smaller image)
COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
# Workers don't need root privileges
USER node
# No EXPOSE needed — workers don't serve HTTP
# Graceful shutdown signal
STOPSIGNAL SIGTERM
# Default: run the market worker (override via docker run args)
CMD ["node", "dist/src/workers/ingest-market.js"]