-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.local
More file actions
75 lines (59 loc) · 2.57 KB
/
Dockerfile.local
File metadata and controls
75 lines (59 loc) · 2.57 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Build local monorepo image
# docker build -f Dockerfile.local -t chronos:local ..
# docker run -d -p 3001:3000 chronos:local
# =============================================================================
# Stage 1: Builder - Install dependencies and build the application
# =============================================================================
FROM node:24-alpine AS builder
# Install build dependencies (these won't be in the final image)
RUN apk add --no-cache \
libc6-compat \
python3 \
make \
g++ \
build-base \
cairo-dev \
pango-dev \
curl && \
npm install -g pnpm@10.33.4
ENV NODE_OPTIONS=--max-old-space-size=8192
# Target Linux platform, skip installing macOS binaries - for prod builds
# Leave commented out if you dev/test on macOS
# ENV npm_config_platform=linux
# ENV npm_config_arch=x64
WORKDIR /app
# Copy all source files (respects .dockerignore)
COPY . .
# Install deps, build, then prune devDependencies in-place
# (preserves compiled native binaries like sqlite3 for musl/Alpine)
RUN pnpm install --frozen-lockfile && pnpm build && CI=true pnpm prune --prod
# =============================================================================
# Stage 2: Production - Minimal runtime image
# =============================================================================
FROM node:24-alpine AS production
# Install only runtime dependencies
RUN apk add --no-cache \
libc6-compat \
curl && \
npm install -g pnpm@10.33.4
ENV NODE_ENV=production
WORKDIR /app
# Copy workspace config and dependencies
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./
COPY --from=builder /app/pnpm-workspace.yaml ./
COPY --from=builder /app/node_modules ./node_modules
# Server: compiled output + runtime JSON templates + provider config
COPY --from=builder /app/packages/server/dist ./packages/server/dist
COPY --from=builder /app/packages/server/package.json ./packages/server/
COPY --from=builder /app/packages/server/templates ./packages/server/templates
COPY --from=builder /app/packages/server/providers.config.json ./packages/server/
# UI: Vite build output
COPY --from=builder /app/packages/ui/build ./packages/ui/build
COPY --from=builder /app/packages/ui/package.json ./packages/ui/
# Components: compiled output (includes icons via gulp) + models config
COPY --from=builder /app/packages/components/dist ./packages/components/dist
COPY --from=builder /app/packages/components/package.json ./packages/components/
COPY --from=builder /app/packages/components/models.json ./packages/components/
EXPOSE 3000
CMD ["pnpm", "start"]