-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (45 loc) · 2.01 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (45 loc) · 2.01 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
# Base — shared dependencies (all deps needed for build)
FROM node:20-slim AS base
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
# Build — compile TypeScript
FROM base AS build
COPY . .
RUN npm run build
# Dev — source mounted, hot reload via tsx watch
FROM base AS dev
COPY . .
CMD ["npx", "tsx", "watch", "src/index.ts"]
# Prod — compiled JS only, fresh slim image with prod deps only
FROM node:20-slim AS prod
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
# Optional peer dependencies. `npm ci --omit=dev` above intentionally
# SKIPS these (they are declared as peerDependencies, not dependencies),
# so the default prod image is lean. If your pathfinder.yaml uses any of
# the features below, UNCOMMENT the matching line and rebuild — otherwise
# the server will throw a clear "Install <pkg>" error at runtime when that
# feature is first exercised (e.g. embedding.provider: local).
# RUN npm install pdf-parse mammoth # For type: document (PDF/DOCX)
#
# #88 — `@xenova/transformers` for embedding.provider: local. The CI matrix
# in .github/workflows/publish-docker.yml builds two variants of this image
# from the SAME Dockerfile: the default (slim, arg=false → tags :latest /
# :<ref>) and the `-local` variant (arg=true → tags :latest-local /
# :<ref>-local) which preinstalls the dep below. Default build stays slim.
ARG INCLUDE_LOCAL_EMBEDDINGS=false
RUN if [ "$INCLUDE_LOCAL_EMBEDDINGS" = "true" ]; then \
npm install @xenova/transformers; \
fi
COPY --from=build /app/dist/ ./dist/
COPY docs/analytics.html ./docs/analytics.html
COPY deploy/copilotkit-docs.yaml ./copilotkit-docs.yaml
COPY deploy/pathfinder-docs.yaml ./pathfinder-docs.yaml
COPY deploy/aimock-docs.yaml ./aimock-docs.yaml
COPY pathfinder.example.yaml ./pathfinder.example.yaml
COPY .env.example ./.env.example
CMD ["node", "dist/cli.js", "serve"]