sbx-opencodev2/Makefile

38 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2026-10-10 23:51:14 +02:00
# Utilities for running the OpenCode agent in a Docker Sandbox.
# Requires the `sbx` CLI: https://docs.docker.com/ai/sandboxes/install/
#
# `sbx` doesn't have a nested sandbox-in-sandbox mode, so these targets are
# meant to be run on your host machine from this directory (where sbxenv.yaml
# lives), not from inside another sandbox.
NAME ?= opencode-v2
AGENT ?= opencode
IMAGE_TAG ?= opencode-v2:local
OPENCODE_VERSION ?= 2.0.26
.PHONY: help cli-check image build install
help:
@echo "NAME=$(NAME) AGENT=$(AGENT) OPENCODE_VERSION=$(OPENCODE_VERSION)"
@echo ""
@echo " make image build the $(IMAGE_TAG) image pinning the opencode CLI version"
@echo " make build [OPENCODE_VERSION=...] build the image and register it with sbx as a local template"
@echo " make install install the opencode-sandbox shim to ~/.local/bin"
cli-check:
@command -v sbx >/dev/null 2>&1 || { \
echo "sbx CLI not found. Install it: https://docs.docker.com/ai/sandboxes/install/"; \
exit 1; \
}
@sbx version
image:
docker build --build-arg OPENCODE_VERSION=$(OPENCODE_VERSION) -t $(IMAGE_TAG) .
build: cli-check image
docker image save $(IMAGE_TAG) -o /tmp/opencode-v2.tar
sbx template load /tmp/opencode-v2.tar
install:
sh ./install.sh