-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (40 loc) · 1.46 KB
/
Dockerfile
File metadata and controls
50 lines (40 loc) · 1.46 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
FROM node:22-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Install build dependencies for native modules (better-sqlite3, node-llama-cpp)
RUN apk add --no-cache python3 make g++ curl
# Install dependencies
FROM base AS deps
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile || pnpm install
# Build native modules (better-sqlite3, sqlite-vec, etc.)
RUN pnpm approve-builds || true
# Build
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
# Production
FROM base AS runner
ENV NODE_ENV=production
# Copy built output and dependencies
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
# Copy dashboard static assets (CSS + JS served at runtime)
COPY --from=builder /app/src/dashboard/style.css ./dist/dashboard/
COPY --from=builder /app/src/dashboard/main.js ./dist/dashboard/
# Copy runtime directories
COPY --from=builder /app/skills ./skills
COPY --from=builder /app/extensions ./extensions
COPY --from=builder /app/.env.example ./.env.example
COPY --from=builder /app/drizzle ./drizzle
# Create data and config directories
RUN mkdir -p /app/data /app/config /app/.openwhale
# Non-root user for security
RUN addgroup --system --gid 1001 openwhale && \
adduser --system --uid 1001 openwhale && \
chown -R openwhale:openwhale /app
USER openwhale
EXPOSE 7777
CMD ["node", "dist/index.js"]