-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 1.1 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
49
FROM node:22-alpine AS builder
WORKDIR /app
# Install dependencies first (cached layer)
COPY package.json package-lock.json* ./
RUN npm ci --ignore-scripts
# Copy source
COPY tsconfig.json ./
COPY src/ ./src/
COPY demo/ ./demo/
COPY scripts/ ./scripts/
COPY data/first_speaker_wins_model/ ./data/first_speaker_wins_model/
# Build
RUN npx tsc
# ── Production image ──
FROM node:22-alpine
WORKDIR /app
# Install production deps only
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev --ignore-scripts && npm cache clean --force
# Copy built output
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/data/first_speaker_wins_model ./data/first_speaker_wins_model
# Create data directory for SQLite
RUN mkdir -p ./data && chown -R node:node ./data
# Non-root user
USER node
# Env defaults
ENV NODE_ENV=production
ENV PORT=3000
ENV DASHBOARD_PORT=3001
ENV DB_PATH=./data/ridhwan.db
EXPOSE 3000 3001
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
CMD ["node", "dist/src/index.js"]