-
-
Notifications
You must be signed in to change notification settings - Fork 302
Expand file tree
/
Copy pathDockerfile
More file actions
101 lines (89 loc) · 3.49 KB
/
Dockerfile
File metadata and controls
101 lines (89 loc) · 3.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# syntax=docker/dockerfile:1
# ── Stage 1: Build web app ──
FROM oven/bun:1 AS builder
# Install Zig. agent-native postinstall prefers downloading a prebuilt .node
# matching the submodule commit from the ZSeven-W/agent release, but falls
# back to `zig build napi` when no matching asset exists (e.g. building for
# an arch we don't publish yet). Pin 0.15.2 because the Zig source uses the
# unmanaged ArrayList / std.process.getEnvVarOwned shape introduced in 0.15.
RUN apt-get update && apt-get install -y --no-install-recommends curl xz-utils ca-certificates \
&& ARCH="$(uname -m)" \
&& case "$ARCH" in \
x86_64) ZIG_ARCH=x86_64 ;; \
aarch64) ZIG_ARCH=aarch64 ;; \
*) echo "Unsupported arch: $ARCH" && exit 1 ;; \
esac \
&& curl -fsSL "https://ziglang.org/download/0.15.2/zig-${ZIG_ARCH}-linux-0.15.2.tar.xz" \
| tar -xJ -C /usr/local \
&& ln -sf "/usr/local/zig-${ZIG_ARCH}-linux-0.15.2/zig" /usr/local/bin/zig \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json bun.lock ./
COPY --parents packages/*/package.json apps/*/package.json ./
# agent-native is a git submodule with a nested workspace package (napi/)
# and Zig sources needed by the postinstall hook — copy it whole.
COPY packages/agent-native ./packages/agent-native
RUN bun install --frozen-lockfile
COPY . .
ENV NODE_OPTIONS="--max-old-space-size=4096"
RUN bun --bun run build
# ── Stage 2: Base (web only, no CLI) ──
FROM oven/bun:1-slim AS base
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
ENV NODE_ENV=production
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
# ── CLI variants ──
FROM oven/bun:1 AS with-claude
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g @anthropic-ai/claude-code
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
FROM oven/bun:1 AS with-codex
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g @openai/codex
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
FROM oven/bun:1 AS with-opencode
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g opencode-ai
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
FROM oven/bun:1 AS with-copilot
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g @github/copilot
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
FROM oven/bun:1 AS with-gemini
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g @google/gemini-cli
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]
# ── Full: all CLI tools ──
FROM oven/bun:1 AS full
WORKDIR /app
COPY --from=builder /app/out/web ./out/web
COPY --from=builder /app/package.json ./
RUN bun install -g @anthropic-ai/claude-code @openai/codex opencode-ai @github/copilot @google/gemini-cli
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./out/web/server/index.mjs"]