|
| 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