-
Notifications
You must be signed in to change notification settings - Fork 4
feat(docker): add OpenCode example Dockerfile #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+53
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # examples/docker/opencode.Dockerfile | ||
| # | ||
| # Complete working example: Sortie + OpenCode agent. | ||
| # | ||
| # OpenCode requires Node.js (>= 18), npm, and git. It authenticates through | ||
| # provider environment variables such as ANTHROPIC_API_KEY or OPENAI_API_KEY. | ||
| # The container runs as a non-root user for security best practices. | ||
| # | ||
| # Build: | ||
| # docker build -f examples/docker/opencode.Dockerfile -t sortie-opencode . | ||
| # | ||
| # Run: | ||
| # docker run --rm --init \ | ||
| # -e ANTHROPIC_API_KEY \ | ||
| # -v "$(pwd)/workspaces:/home/sortie/workspaces" \ | ||
| # -v "$(pwd)/WORKFLOW.md:/home/sortie/WORKFLOW.md:ro" \ | ||
| # -p 7678:7678 \ | ||
| # sortie-opencode /home/sortie/WORKFLOW.md | ||
|
|
||
| FROM ghcr.io/sortie-ai/sortie:latest AS sortie | ||
|
|
||
| FROM node:24-slim | ||
|
|
||
| # Install git for repository-backed runs. | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| git wget && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install OpenCode globally. | ||
| RUN npm install -g opencode-ai@latest && npm cache clean --force | ||
|
|
||
| # Create a non-root user. The node base image ships a "node" user at UID 1000; | ||
| # remove it so we can claim that UID for the sortie user. | ||
| RUN userdel -r node 2>/dev/null; \ | ||
| useradd --create-home --shell /bin/bash --uid 1000 sortie | ||
|
|
||
| # Copy the Sortie binary from the distroless image. | ||
| COPY --from=sortie /usr/bin/sortie /usr/bin/sortie | ||
|
|
||
| # Switch to the non-root user for all subsequent operations. | ||
| USER sortie | ||
| WORKDIR /home/sortie | ||
|
|
||
| # The HTTP observability server listens on all interfaces so the host | ||
| # can reach it through the published port. | ||
| EXPOSE 7678 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | ||
| CMD wget -qO /dev/null http://localhost:7678/readyz || exit 1 | ||
|
|
||
| ENTRYPOINT ["/usr/bin/sortie", "--host", "0.0.0.0", "--log-format", "json"] | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment says only git is being installed, but this layer also installs wget (required for the HEALTHCHECK below). Consider updating the comment to reflect both packages so the dependency is clear.