-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.opencode
More file actions
43 lines (36 loc) · 1.9 KB
/
Copy pathDockerfile.opencode
File metadata and controls
43 lines (36 loc) · 1.9 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
# ---- Stage 1: extract conproxy release binary ----
# Tilt has already built conproxy:dev with --features release (includes mcp).
FROM conproxy:dev AS conproxy-bin
# ---- Stage 2: opencode on glibc (node:22-bookworm-slim) ----
# We use a glibc-based Node image because the conproxy binary is dynamically
# linked against glibc and will not run on musl-based Alpine.
FROM node:22-bookworm-slim
# Install CA certificates (rustls needs them at init even for plain HTTP).
# Install `less` for `opencode session list` interactive paging (bookworm-slim
# omits it; without it `docker exec opencode-test opencode session list` fails
# with "Executable not found in $PATH: less"). Smoke scripts use --format json
# to avoid the pager, but interactive `make devex-attach` needs it.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
less \
&& rm -rf /var/lib/apt/lists/*
# Install opencode CLI
RUN npm install -g opencode-ai 2>&1
# Global conproxy config — defines the listen address so the MCP server's
# Config::load() knows where to dial the proxy.
# --network host → 127.0.0.1:9999 is Tilt's port-forward to the proxy pod.
RUN mkdir -p /root/.conproxy
COPY conproxy.toml /root/.conproxy/conproxy.toml
# Per-project opencode config — registers conproxy as a local stdio MCP server.
WORKDIR /app
COPY opencode.json /app/opencode.json
# conproxy binary → PATH
COPY --from=conproxy-bin /usr/local/bin/conproxy /usr/local/bin/conproxy
# Keep the container alive by running the opencode headless server. Smoke
# scripts attach to it (http://127.0.0.1:14096) and a human can resume the
# session with `make devex-attach` / `docker exec -it opencode-test opencode -s <sid>`.
# Port 14096 is fixed; override with DEVEX_OPENCODE_PORT (host network → on host too).
EXPOSE 14096
ENV OPENCODE_PORT=14096
ENTRYPOINT []
CMD ["sh", "-c", "exec opencode serve --hostname 0.0.0.0 --port ${OPENCODE_PORT}"]