-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (26 loc) · 880 Bytes
/
Dockerfile
File metadata and controls
34 lines (26 loc) · 880 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
# =============================================
# Stage 1: Builder (with native compilation tools)
# =============================================
FROM node:20-alpine AS builder
# Install build dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Install dependencies first (for layer caching)
COPY package*.json ./
RUN npm install
# Copy source and build
COPY . .
RUN npm run build
RUN npm run db:push
# =============================================
# Stage 2: Production Runtime (minimal image)
# =============================================
FROM node:20-alpine
WORKDIR /app
# Copy only what's needed from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/local.db ./local.db
EXPOSE 5000
CMD ["npm", "start"]