-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (52 loc) · 1.49 KB
/
Dockerfile
File metadata and controls
69 lines (52 loc) · 1.49 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
# Base stage with build dependencies
FROM node:22-slim AS base
WORKDIR /app
# Install build dependencies for native modules (better-sqlite3, tree-sitter, etc.)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
make \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Build stage
FROM base AS builder
# Accept build argument for PostHog API key
ARG POSTHOG_API_KEY
ENV POSTHOG_API_KEY=$POSTHOG_API_KEY
# Copy package files
COPY package*.json ./
# Install all dependencies (including dev dependencies for building)
RUN npm ci
# Copy source code
COPY . .
# Build application
RUN npm run build
# Production stage
FROM base AS production
# Set environment variables for Playwright
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
# Install Chromium from apt-get
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
chromium \
&& rm -rf /var/lib/apt/lists/*
# Copy package files and database
COPY package*.json .
COPY db db
# Copy built files from builder
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/public ./public
COPY --from=builder /app/dist ./dist
# Set data directory for the container
ENV DOCS_MCP_STORE_PATH=/data
ENV XDG_CONFIG_HOME=/config
# Define volumes
VOLUME /data
VOLUME /config
# Expose the default port of the application
EXPOSE 6280
ENV PORT=6280
ENV HOST=0.0.0.0
# Set the command to run the application
ENTRYPOINT ["node", "--enable-source-maps", "dist/index.js"]