Skip to content

Commit 918af06

Browse files
committed
feat(docker): add OpenCode example Dockerfile
1 parent 90a26a2 commit 918af06

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

examples/docker/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Build an agent-specific image from the repository root:
1313
docker build -f examples/docker/claude-code.Dockerfile -t sortie-claude .
1414
docker build -f examples/docker/codex.Dockerfile -t sortie-codex .
1515
docker build -f examples/docker/copilot.Dockerfile -t sortie-copilot .
16+
docker build -f examples/docker/opencode.Dockerfile -t sortie-opencode .
1617
```
1718

1819
Run it:
@@ -33,6 +34,7 @@ docker run --rm --init \
3334
| `claude-code.Dockerfile` | Claude Code | `node:24-slim` |
3435
| `codex.Dockerfile` | OpenAI Codex CLI | `debian:bookworm-slim` |
3536
| `copilot.Dockerfile` | GitHub Copilot | `node:24-slim` |
37+
| `opencode.Dockerfile` | OpenCode | `node:24-slim` |
3638

3739
Each Dockerfile follows the same pattern: copy the Sortie binary from the
3840
distroless image (`ghcr.io/sortie-ai/sortie`), install the agent, create a
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# examples/docker/opencode.Dockerfile
2+
#
3+
# Complete working example: Sortie + OpenCode agent.
4+
#
5+
# OpenCode requires Node.js (>= 18), npm, and git. It authenticates through
6+
# provider environment variables such as ANTHROPIC_API_KEY or OPENAI_API_KEY.
7+
# The container runs as a non-root user for security best practices.
8+
#
9+
# Build:
10+
# docker build -f examples/docker/opencode.Dockerfile -t sortie-opencode .
11+
#
12+
# Run:
13+
# docker run --rm --init \
14+
# -e ANTHROPIC_API_KEY \
15+
# -v "$(pwd)/workspaces:/home/sortie/workspaces" \
16+
# -v "$(pwd)/WORKFLOW.md:/home/sortie/WORKFLOW.md:ro" \
17+
# -p 7678:7678 \
18+
# sortie-opencode /home/sortie/WORKFLOW.md
19+
20+
FROM ghcr.io/sortie-ai/sortie:latest AS sortie
21+
22+
FROM node:24-slim
23+
24+
# Install git for repository-backed runs.
25+
RUN apt-get update && apt-get install -y --no-install-recommends \
26+
git wget && \
27+
rm -rf /var/lib/apt/lists/*
28+
29+
# Install OpenCode globally.
30+
RUN npm install -g opencode-ai@latest && npm cache clean --force
31+
32+
# Create a non-root user. The node base image ships a "node" user at UID 1000;
33+
# remove it so we can claim that UID for the sortie user.
34+
RUN userdel -r node 2>/dev/null; \
35+
useradd --create-home --shell /bin/bash --uid 1000 sortie
36+
37+
# Copy the Sortie binary from the distroless image.
38+
COPY --from=sortie /usr/bin/sortie /usr/bin/sortie
39+
40+
# Switch to the non-root user for all subsequent operations.
41+
USER sortie
42+
WORKDIR /home/sortie
43+
44+
# The HTTP observability server listens on all interfaces so the host
45+
# can reach it through the published port.
46+
EXPOSE 7678
47+
48+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
49+
CMD wget -qO /dev/null http://localhost:7678/readyz || exit 1
50+
51+
ENTRYPOINT ["/usr/bin/sortie", "--host", "0.0.0.0", "--log-format", "json"]

0 commit comments

Comments
 (0)