-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (41 loc) · 1.64 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (41 loc) · 1.64 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
50
51
52
53
54
55
56
57
58
# ── Stage 1: Build frontend ──────────────────────────────────
FROM node:20-slim AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run generate
# ── Stage 2: Build backend native modules ────────────────────
FROM node:20-slim AS backend-build
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app/backend
COPY backend/package.json backend/package-lock.json ./
# Production deps only (native modules compiled here)
RUN npm ci --omit=dev
# ── Stage 3: Production image (lean) ────────────────────────
FROM node:20-slim
# ffmpeg (runtime) + tsx (runs TS directly)
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& npm i -g tsx
WORKDIR /app
# Pre-built node_modules (production only, native modules ready)
COPY --from=backend-build /app/backend/node_modules ./backend/node_modules
COPY backend/package.json backend/package-lock.json ./backend/
# Backend source
COPY backend/src ./backend/src
COPY backend/tsconfig.json ./backend/
# Frontend static output
COPY --from=frontend-build /app/frontend/.output/public ./frontend/dist
# Skills
COPY skills/ ./backend/skills/
# Config
COPY configs/config.example.yaml ./configs/config.yaml
RUN mkdir -p data/static
ENV NODE_ENV=production
ENV PORT=5679
EXPOSE 5679
VOLUME ["/app/data"]
CMD ["tsx", "backend/src/index.ts"]