Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (47 loc) · 2.2 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (47 loc) · 2.2 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
# bun.lock covers the whole workspace (root package.json declares
# `workspaces: ["packages/*"]`), so `--frozen-lockfile` needs every
# workspace member's own package.json present to validate the lockfile
# against -- without it, bun reports "lockfile had changes, but lockfile
# is frozen" even though the lockfile itself is correct; it's just missing
# context, not a stale lockfile. Add each workspace member's manifest
# alongside the root ones. There is exactly one member today
# (packages/agentpulse-mcp); add a new COPY line here if a second one is
# ever introduced.
FROM oven/bun:1.3.12 AS deps
WORKDIR /app
COPY package.json bun.lock ./
COPY packages/agentpulse-mcp/package.json ./packages/agentpulse-mcp/
RUN bun install --frozen-lockfile --production
FROM oven/bun:1.3.12 AS builder
WORKDIR /app
COPY package.json bun.lock ./
COPY packages/agentpulse-mcp/package.json ./packages/agentpulse-mcp/
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
FROM oven/bun:1.3.12-slim AS runner
WORKDIR /app
# Pre-create runtime-writable directories and hand them to the non-root
# bun user (UID 1000) before we drop privileges. Docker named-volume
# mounts inherit the image-directory ownership on first use, so this
# chown is what keeps /app/data writable after `USER bun`.
# On k8s the PVC mount ownership is governed by fsGroup: 1000 in the
# pod securityContext, which makes the mount group-writable by GID 1000.
RUN mkdir -p /app/data && chown -R bun:bun /app/data
COPY --chown=bun:bun --from=deps /app/node_modules ./node_modules
COPY --chown=bun:bun --from=builder /app/dist ./dist
COPY --chown=bun:bun --from=builder /app/src/server ./src/server
COPY --chown=bun:bun --from=builder /app/src/shared ./src/shared
COPY --chown=bun:bun --from=builder /app/scripts ./scripts
COPY --chown=bun:bun --from=builder /app/drizzle ./drizzle
COPY --chown=bun:bun --from=builder /app/package.json ./
ENV NODE_ENV=production
ENV PORT=3000
ENV HOST=0.0.0.0
# Read by the server to tell a container from a source checkout (src/shared/install-record.ts).
ENV AGENTPULSE_INSTALL_KIND=container
# Drop to non-root. oven/bun:1-slim ships a `bun` user at UID 1000.
USER bun
EXPOSE 3000
VOLUME ["/app/data"]
CMD ["bun", "run", "src/server/index.ts"]