Python
Publish the CLI image to GitHub's container registry
Rohit C Prasad00ebf7979f76
diff --git a/.github/workflows/image.yml b/.github/workflows/image.ymlnew file mode 100644index 00000000..eb2cd900--- /dev/null+++ b/.github/workflows/image.yml@@ -0,0 +1,97 @@+# The OpenWorker CLI image (packaging/openshell/Dockerfile), published to GitHub's container+# registry as ghcr.io/<owner>/<repo>, for Intel and ARM. See docs/openshell-inside.md.+#+# Triggers:+# - a release is published → tags `<version>` and `latest`. A draft release publishes+# nothing; desktop-only releases (`app-v*`) are skipped.+# - manual run → tags `edge`, the CLI as it is on the chosen branch. Tick+# "also tag as latest" to move `latest` to it as well.+#+# The image is checked on this runner before anything is pushed. The ARM half is built+# under emulation, which is slow but needs no second runner.++name: Image++on:+ release:+ types: [published]+ workflow_dispatch:+ inputs:+ latest:+ description: Also tag as latest+ type: boolean+ default: false++permissions:+ contents: read+ packages: write++jobs:+ image:+ if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')+ runs-on: ubuntu-latest+ timeout-minutes: 60+ steps:+ - uses: actions/checkout@v4++ - name: Name and tags+ id: name+ env:+ RELEASE_TAG: ${{ github.event.release.tag_name }}+ ALSO_LATEST: ${{ inputs.latest }}+ run: |+ image="ghcr.io/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]')"+ if [ -n "$RELEASE_TAG" ]; then+ tags="$image:${RELEASE_TAG#v},$image:latest"+ elif [ "$ALSO_LATEST" = "true" ]; then+ tags="$image:edge,$image:latest"+ else+ tags="$image:edge"+ fi+ echo "tags=$tags" >> "$GITHUB_OUTPUT"++ - uses: docker/setup-qemu-action@v3+ - uses: docker/setup-buildx-action@v3++ - name: Build for this runner+ uses: docker/build-push-action@v6+ with:+ context: .+ file: packaging/openshell/Dockerfile+ load: true+ tags: openworker:check+ cache-from: type=gha+ cache-to: type=gha,mode=max++ - name: Check the image+ run: |+ docker run --rm openworker:check sh -c '+ set -e+ openworker --version+ openworker run --help > /dev/null+ test "$(id -u)" = 1000+ for tool in ip git curl node npm python rg fd jq gh uv make cc; do+ command -v "$tool" > /dev/null || { echo "missing: $tool"; exit 1; }+ done+ '++ - uses: docker/login-action@v3+ with:+ registry: ghcr.io+ username: ${{ github.actor }}+ password: ${{ secrets.GITHUB_TOKEN }}++ - name: Build for Intel and ARM, and push+ uses: docker/build-push-action@v6+ with:+ context: .+ file: packaging/openshell/Dockerfile+ platforms: linux/amd64,linux/arm64+ push: true+ tags: ${{ steps.name.outputs.tags }}+ labels: |+ org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}+ org.opencontainers.image.description=The OpenWorker CLI with common developer tools+ org.opencontainers.image.licenses=MIT+ cache-from: type=gha+ cache-to: type=gha,mode=maxdiff --git a/docs/openshell-inside.md b/docs/openshell-inside.mdindex 1bfa416a..f02cde56 100644--- a/docs/openshell-inside.md+++ b/docs/openshell-inside.md@@ -21,10 +21,14 @@ Tested with OpenShell 0.1.2 on a Mac with Docker Desktop.The image holds the OpenWorker CLI and common developer tools: Python, Node, git, curl,ripgrep, `gh`, `uv`, `make` and a C compiler.-Build it from a checkout of this repository:+It is published as `ghcr.io/andrewyng/openworker:latest`, for Intel and ARM. There is+nothing to download first: OpenShell pulls it the first time you use it.++To build your own from a checkout of this repository, and use `openworker:local` in place+of the name below:```bash-docker build -f packaging/openshell/Dockerfile -t openworker-openshell:local .+docker build -f packaging/openshell/Dockerfile -t openworker:local .```## 2. Give OpenShell your model key@@ -50,7 +54,7 @@ You do this once. The provider stays on your gateway.One command starts a sandbox, runs the task and removes the sandbox:```bash-openshell sandbox create --from openworker-openshell:local \+openshell sandbox create --from ghcr.io/andrewyng/openworker:latest \--provider openworker-openai --no-keep \-- openworker run --approval-mode bypass-approvals --prompt "Say hello"```@@ -68,7 +72,7 @@ A sandbox has its own files. Bring a project in, run the task, and take the resu```bash# A sandbox that stays up-openshell sandbox create --name work --from openworker-openshell:local \+openshell sandbox create --name work --from ghcr.io/andrewyng/openworker:latest \--provider openworker-openai --detach -- sleep infinity# Copy the project in. It lands at /sandbox/my-projectdiff --git a/packaging/openshell/Dockerfile b/packaging/openshell/Dockerfileindex d9c25091..f8cb996f 100644--- a/packaging/openshell/Dockerfile+++ b/packaging/openshell/Dockerfile@@ -1,14 +1,15 @@# OpenWorker's CLI in an image for OpenShell (https://github.com/NVIDIA/OpenShell):#-# openshell sandbox create --from ghcr.io/andrewyng/openworker-openshell:latest \+# openshell sandbox create --from ghcr.io/andrewyng/openworker:latest \# --provider <your model provider> -- openworker run --prompt "..."## What OpenShell asks of an image: a standard Linux base, a non-root USER, and iproute2# (nftables lets it also log direct connections). The rest is the CLI and the tools an# agent's commands usually reach for. See docs/openshell-inside.md.#-# Build from the repository root, so the CLI in the image is this checkout:-# docker build -f packaging/openshell/Dockerfile -t openworker-openshell:local .+# Published by .github/workflows/image.yml. To build your own, from the repository root, so+# the CLI in the image is this checkout:+# docker build -f packaging/openshell/Dockerfile -t openworker:local .FROM node:22-bookworm-slim AS nodediff --git a/packaging/openshell/providers/openworker-anthropic.yaml b/packaging/openshell/providers/openworker-anthropic.yamlindex 19ddf0cc..97061514 100644--- a/packaging/openshell/providers/openworker-anthropic.yaml+++ b/packaging/openshell/providers/openworker-anthropic.yaml@@ -5,7 +5,7 @@# --type openworker-anthropic --from-existing## Client binary: OpenWorker's own Python, as installed in-# ghcr.io/andrewyng/openworker-openshell (packaging/openshell/Dockerfile).+# ghcr.io/andrewyng/openworker (packaging/openshell/Dockerfile).# Commands OpenWorker starts count as OpenWorker too.# Credential scope: ANTHROPIC_API_KEY, sent in the x-api-key header to# api.anthropic.com and nowhere else. Inside the sandbox the variablediff --git a/packaging/openshell/providers/openworker-openai.yaml b/packaging/openshell/providers/openworker-openai.yamlindex 379c7f4a..0e57b65d 100644--- a/packaging/openshell/providers/openworker-openai.yaml+++ b/packaging/openshell/providers/openworker-openai.yaml@@ -5,7 +5,7 @@# --type openworker-openai --from-existing## Client binary: OpenWorker's own Python, as installed in-# ghcr.io/andrewyng/openworker-openshell (packaging/openshell/Dockerfile).+# ghcr.io/andrewyng/openworker (packaging/openshell/Dockerfile).# Commands OpenWorker starts count as OpenWorker too.# Credential scope: OPENAI_API_KEY, sent as a bearer token to api.openai.com and# nowhere else. Inside the sandbox the variable holds a placeholder.