1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/bash
: <<'COMMENT'
Publish the zed-ssh kit (shell sandbox driven from the host's Zed, remote development over SSH) to Docker Hub as an OCI image.
Doc: https://docs.docker.com/ai/sandboxes/customize/author/distribute/
1. docker login (once, with the Docker Hub account)
2. Update TAG in release.env (shared with 01-release.tag.sh)
3. Run this script: ./09-publish-zed-ssh-kit.sh
- DOCKER_HUB_NAMESPACE=foo ./09-publish-zed-ssh-kit.sh to push under another namespace
- SIGN=1 ./09-publish-zed-ssh-kit.sh to sign the kit after the push
(keyless, `sbx kit sign`)
Then anyone can use it:
sbx setup ssh
sbx create --name my-box docker.io/<NAMESPACE>/zed-ssh-kit:<TAG> /path/to/workspace
zed --new ssh://my-box.sbx/path/to/workspace
COMMENT
set -euo pipefail
set -o allexport
source release.env
set +o allexport
NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}"
KIT_DIR="./kits/zed-ssh"
KIT_FILE="${KIT_DIR}/kit.yaml"
# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2
VERSION="${TAG#v}"
IMAGE="docker.io/${NAMESPACE}/zed-ssh-kit"
PLATFORMS="linux/amd64,linux/arm64"
echo "Publishing ${IMAGE}:${VERSION} (and :latest) for ${PLATFORMS}"
# A multi-platform push needs a builder that can do it: the default "docker"
# driver cannot (unless the containerd image store is on), so use a
# docker-container builder, created once and reused afterwards.
BUILDER="sandbox-kit-builder"
if ! docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then
docker buildx create --name "${BUILDER}" --driver docker-container >/dev/null
fi
# The descriptor (kit.yaml) is passed as the "Dockerfile": its
# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds
# the workload from kit.dockerfile and packs the kit metadata with it.
docker buildx build "${KIT_DIR}" -f "${KIT_FILE}" \
--builder "${BUILDER}" \
--platform "${PLATFORMS}" \
-t "${IMAGE}:${VERSION}" \
-t "${IMAGE}:latest" \
--push
if [ "${SIGN:-0}" = "1" ]; then
sbx kit sign "${IMAGE}:${VERSION}"
fi
echo "✅ Published ${IMAGE}:${VERSION}"
echo "💡 Try it: sbx create --name my-box ${IMAGE}:${VERSION} /path/to/workspace && zed --new ssh://my-box.sbx/path/to/workspace"
|