-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (38 loc) · 1.73 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (38 loc) · 1.73 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
# ── Build stage: compile the backend TypeScript ─────────────────────────────
FROM node:22-alpine AS builder
WORKDIR /app
# Copy root and workspace package files
COPY package*.json ./
COPY backend/package*.json backend/
COPY frontend/package*.json frontend/
COPY healthcheck/package*.json healthcheck/
COPY website/package*.json website/
COPY shared/package*.json shared/
# Install dependencies for the workspaces
RUN YOUTUBE_DL_SKIP_PYTHON_CHECK=1 npm install
# Copy shared workspace and build shared & backend
COPY shared/ shared/
COPY backend/tsconfig.json backend/
COPY backend/src/ backend/src/
RUN npm run build -w shared
RUN npm run build -w backend
RUN npm run build:off -w backend
RUN npm prune --omit=dev --workspace=backend
# ── Production stage: minimal runtime ──────────────────────────────────────
FROM node:22-alpine
WORKDIR /app
# Copy production dependencies and built artifacts
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/shared ./shared
COPY --from=builder /app/backend/package.json ./backend/package.json
COPY --from=builder /app/backend/dist ./backend/dist
COPY --from=builder /app/backend/src/data/off_de.sqlite ./backend/dist/data/off_de.sqlite
# Copy public static assets (category icons, ingredient-icons.zip)
COPY backend/public ./backend/public
# Install runtime dependencies (ffmpeg/ffprobe for frame extraction, python3 for yt-dlp, ttf-dejavu for text-drawing fonts)
RUN apk add --no-cache ffmpeg python3 ttf-dejavu
# Create directories for runtime artifacts
RUN mkdir -p logs
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "backend/dist/index.js"]