bots-garden/mini-me-kitpublic Fork
⑂ v0.1.7
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me-kit.git
git clone ssh://git@rickub.com/bots-garden/mini-me-kit.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
🛟 Updated. d56d1f4 · on v0.1.7 · k33g · 13d ago
12-publish-kotlin-toolchain-kit.sh · 57 lines · 2.3 KBBash Blame HistoryRaw
 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
#!/bin/bash
: <<'COMMENT'
Publish the kotlin-toolchain kit (a mixin) 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: ./12-publish-kotlin-toolchain-kit.sh
   - DOCKER_HUB_NAMESPACE=foo ./12-publish-kotlin-toolchain-kit.sh   to push under another namespace
   - SIGN=1 ./12-publish-kotlin-toolchain-kit.sh                     to sign the kit after the push
                                                                  (keyless, `sbx kit sign`)

Then anyone can add it to a sandbox:
   sbx run --name mm-demo docker.io/<NAMESPACE>/mini-me-kit:<TAG> \
     --kit docker.io/<NAMESPACE>/kotlin-toolchain-kit:<TAG>
COMMENT

set -euo pipefail

set -o allexport
source release.env
set +o allexport

NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}"
KIT_DIR="./kits/kotlin-toolchain"
KIT_FILE="${KIT_DIR}/kotlin-toolchain.yaml"
# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2
VERSION="${TAG#v}"
IMAGE="docker.io/${NAMESPACE}/kotlin-toolchain-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 (kotlin-toolchain.yaml) is passed as the "Dockerfile": its
# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds
# the overlay from kotlin-toolchain.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 run --name mm-demo docker.io/${NAMESPACE}/${REPO}:${VERSION} --kit ${IMAGE}:${VERSION}"