Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: npm

on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: "Release tag to publish (e.g., v1.34.0)"
required: true
type: string
dry_run:
description: "Dry run (do not publish to npm)"
required: false
type: boolean
default: false

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0

- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642195f882660b323136e12 # v4.4.0
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"

- name: Determine version
id: version
run: |
TAG="${{ inputs.release_tag || github.event.release.tag_name }}"
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Cross-compile binaries
run: |
docker buildx build \
--target=cross \
--build-arg GIT_TAG="${{ steps.version.outputs.tag }}" \
--build-arg GIT_COMMIT="${{ github.sha }}" \
--platform linux/amd64,linux/arm64,darwin/amd64,darwin/arm64,windows/amd64,windows/arm64 \
--output=./dist \
.

- name: Package npm packages
run: |
chmod +x npm/scripts/package.sh
./npm/scripts/package.sh "${{ steps.version.outputs.version }}"

- name: Verify packages
run: |
echo "=== Main package ==="
cat npm/docker-agent/package.json
echo ""
echo "=== Platform packages ==="
for pkg in npm/docker-agent-*/; do
echo "--- $(basename "$pkg") ---"
cat "$pkg/package.json"
ls -lh "$pkg/"
echo ""
done

- name: Publish platform packages
if: ${{ !inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
for pkg in npm/docker-agent-*/; do
echo "Publishing $(basename "$pkg")..."
(cd "$pkg" && npm publish --access public)
done

- name: Publish main package
if: ${{ !inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "Publishing @docker/docker-agent..."
cd npm/docker-agent && npm publish --access public

- name: Dry run - show what would be published
if: ${{ inputs.dry_run }}
run: |
for pkg in npm/docker-agent-*/; do
echo "=== Would publish $(basename "$pkg") ==="
(cd "$pkg" && npm pack --dry-run)
echo ""
done
echo "=== Would publish @docker/docker-agent ==="
(cd npm/docker-agent && npm pack --dry-run)
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bin
!npm/docker-agent/bin/
dist
.task
.DS_Store
Expand All @@ -21,3 +22,9 @@ vendor
/cagent
/cagent-*
/docker-mcp-*

# npm platform binaries (copied in by npm/scripts/package.sh)
npm/docker-agent-*/docker-agent
npm/docker-agent-*/docker-agent.exe
npm/docker-agent/LICENSE
npm/docker-agent/README.md
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ docker agent run agent.yaml

**Homebrew** — `brew install docker-agent`. Run `docker-agent` directly or symlink the binary to `~/.docker/cli-plugins/docker-agent` and run `docker agent`.

**npm** — `npx -y @docker/docker-agent` to run directly, or `npm install -g @docker/docker-agent` to install globally.

**Binary releases** — Download from [GitHub Releases](https://github.com/docker/docker-agent/releases). Symlink the `docker-agent` binary to `~/.docker/cli-plugins/docker-agent` to be able to use `docker agent`, or use `docker-agent` directly.

Set at least one API key (or use [Docker Model Runner](https://docs.docker.com/ai/model-runner/) for local models):
Expand Down
9 changes: 9 additions & 0 deletions npm/docker-agent-darwin-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-darwin-arm64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-darwin-arm64",
"version": "0.0.0",
"description": "Docker Agent binary for macOS ARM64 (Apple Silicon)",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["darwin"],
"cpu": ["arm64"],
"files": [
"docker-agent"
]
}
9 changes: 9 additions & 0 deletions npm/docker-agent-darwin-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-darwin-x64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-darwin-x64",
"version": "0.0.0",
"description": "Docker Agent binary for macOS x64 (Intel)",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["darwin"],
"cpu": ["x64"],
"files": [
"docker-agent"
]
}
9 changes: 9 additions & 0 deletions npm/docker-agent-linux-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-linux-arm64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-linux-arm64",
"version": "0.0.0",
"description": "Docker Agent binary for Linux ARM64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["linux"],
"cpu": ["arm64"],
"files": [
"docker-agent"
]
}
9 changes: 9 additions & 0 deletions npm/docker-agent-linux-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-linux-x64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-linux-x64",
"version": "0.0.0",
"description": "Docker Agent binary for Linux x64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["linux"],
"cpu": ["x64"],
"files": [
"docker-agent"
]
}
9 changes: 9 additions & 0 deletions npm/docker-agent-win32-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-win32-arm64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-win32-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-win32-arm64",
"version": "0.0.0",
"description": "Docker Agent binary for Windows ARM64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["win32"],
"cpu": ["arm64"],
"files": [
"docker-agent.exe"
]
}
9 changes: 9 additions & 0 deletions npm/docker-agent-win32-x64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# @docker/docker-agent-win32-x64

Platform-specific binary package for [Docker Agent](https://github.com/docker/docker-agent).

This package is installed automatically by `@docker/docker-agent` — you don't need to install it directly.

```sh
npx -y @docker/docker-agent
```
15 changes: 15 additions & 0 deletions npm/docker-agent-win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@docker/docker-agent-win32-x64",
"version": "0.0.0",
"description": "Docker Agent binary for Windows x64",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"os": ["win32"],
"cpu": ["x64"],
"files": [
"docker-agent.exe"
]
}
55 changes: 55 additions & 0 deletions npm/docker-agent/bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env node

"use strict";

const { execFileSync } = require("child_process");
const path = require("path");

// Map Node.js platform/arch to npm package names
const PLATFORM_MAP = {
"darwin-arm64": "@docker/docker-agent-darwin-arm64",
"darwin-x64": "@docker/docker-agent-darwin-x64",
"linux-arm64": "@docker/docker-agent-linux-arm64",
"linux-x64": "@docker/docker-agent-linux-x64",
"win32-arm64": "@docker/docker-agent-win32-arm64",
"win32-x64": "@docker/docker-agent-win32-x64",
};

const platformKey = `${process.platform}-${process.arch}`;
const packageName = PLATFORM_MAP[platformKey];

if (!packageName) {
console.error(
`Unsupported platform: ${process.platform} ${process.arch}\n` +
`docker-agent supports: ${Object.keys(PLATFORM_MAP).join(", ")}`
);
process.exit(1);
}

const binaryName = process.platform === "win32" ? "docker-agent.exe" : "docker-agent";

let binaryPath;
try {
// Resolve the platform-specific package and find the binary inside it
const packageDir = path.dirname(require.resolve(`${packageName}/package.json`));
binaryPath = path.join(packageDir, binaryName);
} catch {
console.error(
`Failed to find package ${packageName}.\n` +
`This usually means the optional dependency was not installed.\n` +
`Try reinstalling: npm install @docker/docker-agent`
);
process.exit(1);
}

try {
execFileSync(binaryPath, process.argv.slice(2), {
stdio: "inherit",
});
} catch (err) {
// execFileSync throws on non-zero exit codes; forward the exit code
if (err.status !== null) {
process.exit(err.status);
}
throw err;
}
36 changes: 36 additions & 0 deletions npm/docker-agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@docker/docker-agent",
"version": "0.0.0",
"description": "Docker Agent - Build, run, and share AI agents",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/docker/docker-agent.git"
},
"homepage": "https://docker.github.io/docker-agent/",
"bugs": "https://github.com/docker/docker-agent/issues",
"bin": {
"docker-agent": "bin/cli.js"
},
"files": [
"bin/cli.js",
"README.md",
"LICENSE"
],
"optionalDependencies": {
"@docker/docker-agent-darwin-arm64": "0.0.0",
"@docker/docker-agent-darwin-x64": "0.0.0",
"@docker/docker-agent-linux-arm64": "0.0.0",
"@docker/docker-agent-linux-x64": "0.0.0",
"@docker/docker-agent-win32-arm64": "0.0.0",
"@docker/docker-agent-win32-x64": "0.0.0"
},
"keywords": [
"docker",
"agent",
"ai",
"coding-agent",
"cli",
"mcp"
]
}
Loading
Loading