-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (31 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
42 lines (31 loc) · 1.03 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
FROM node:20-alpine AS base
# Install dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy source
COPY . .
# Ensure public dir exists (may not in all setups)
RUN mkdir -p public
# Pass commit SHA for version footer (git is unavailable in container)
ARG COMMIT_SHA
ENV COMMIT_SHA=$COMMIT_SHA
# Build (standalone output — includes only required node_modules)
RUN npm run build
# Production
FROM node:20-alpine AS runner
# Only the C++ runtime is needed for better-sqlite3 (not the compiler toolchain)
RUN apk add --no-cache libstdc++
WORKDIR /app
# Standalone output includes server.js + minimal node_modules
COPY --from=base /app/.next/standalone ./
# Static assets and public files must be copied separately
COPY --from=base /app/.next/static ./.next/static
COPY --from=base /app/public ./public
COPY --from=base /app/schema.sql ./
COPY --from=base /app/prompts ./prompts
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "server.js"]