-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.agents
More file actions
52 lines (38 loc) · 1.52 KB
/
Copy pathDockerfile.agents
File metadata and controls
52 lines (38 loc) · 1.52 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
FROM node:24-slim AS builder
WORKDIR /app
# Copy workspace root + agents package
COPY package.json package-lock.json ./
COPY packages/agents/package.json packages/agents/package.json
# Install all deps (including dev — mastra CLI needed for build)
RUN npm install
# Copy agent source
COPY packages/agents/ packages/agents/
# Build with mastra
WORKDIR /app/packages/agents
RUN npx mastra build
# --- Production stage ---
FROM node:24-slim
WORKDIR /app
# bubblewrap is the isolation backend for the workspace sandbox (foreman-zlru).
# LocalSandbox defaults to isolation:'none' — commands would otherwise run
# directly on the container's host namespaces. lib/providers/sandbox.ts REFUSES
# to start unisolated when NODE_ENV=production, so this package is required, not
# optional: without it the agent server fails closed at the first sandbox build.
RUN apt-get update \
&& apt-get install -y --no-install-recommends bubblewrap \
&& rm -rf /var/lib/apt/lists/* \
&& bwrap --version
# Copy built output and package files
COPY --from=builder /app/packages/agents/.mastra/output/ .mastra/output/
COPY --from=builder /app/packages/agents/package.json ./
COPY --from=builder /app/package.json /app/root-package.json
COPY --from=builder /app/package-lock.json /app/root-lock.json
# Install production deps
COPY --from=builder /app/node_modules/ node_modules/
# Create data directory for LibSQL local storage
RUN mkdir -p /app/data
VOLUME /app/data
ENV NODE_ENV=production
ENV PORT=4111
EXPOSE 4111
CMD ["node", ".mastra/output/index.mjs"]