🛟 Updated.
d56d1f4 parent: ab2097f added
11-publish-swift-toolchain-kit.sh +57 -0 | new file mode 100755 | ||
| @@ -0,0 +1,57 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +: <<'COMMENT' | |
| 3 | +Publish the swift-toolchain kit (a mixin) to Docker Hub as an OCI image. | |
| 4 | +Doc: https://docs.docker.com/ai/sandboxes/customize/author/distribute/ | |
| 5 | + | |
| 6 | +1. docker login (once, with the Docker Hub account) | |
| 7 | +2. Update TAG in release.env (shared with 01-release.tag.sh) | |
| 8 | +3. Run this script: ./11-publish-swift-toolchain-kit.sh | |
| 9 | + - DOCKER_HUB_NAMESPACE=foo ./11-publish-swift-toolchain-kit.sh to push under another namespace | |
| 10 | + - SIGN=1 ./11-publish-swift-toolchain-kit.sh to sign the kit after the push | |
| 11 | + (keyless, `sbx kit sign`) | |
| 12 | + | |
| 13 | +Then anyone can add it to a sandbox: | |
| 14 | + sbx run --name mm-demo docker.io/<NAMESPACE>/mini-me-kit:<TAG> \ | |
| 15 | + --kit docker.io/<NAMESPACE>/swift-toolchain-kit:<TAG> | |
| 16 | +COMMENT | |
| 17 | + | |
| 18 | +set -euo pipefail | |
| 19 | + | |
| 20 | +set -o allexport | |
| 21 | +source release.env | |
| 22 | +set +o allexport | |
| 23 | + | |
| 24 | +NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}" | |
| 25 | +KIT_DIR="./kits/swift-toolchain" | |
| 26 | +KIT_FILE="${KIT_DIR}/swift-toolchain.yaml" | |
| 27 | +# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2 | |
| 28 | +VERSION="${TAG#v}" | |
| 29 | +IMAGE="docker.io/${NAMESPACE}/swift-toolchain-kit" | |
| 30 | +PLATFORMS="linux/amd64,linux/arm64" | |
| 31 | + | |
| 32 | +echo "Publishing ${IMAGE}:${VERSION} (and :latest) for ${PLATFORMS}" | |
| 33 | + | |
| 34 | +# A multi-platform push needs a builder that can do it: the default "docker" | |
| 35 | +# driver cannot (unless the containerd image store is on), so use a | |
| 36 | +# docker-container builder, created once and reused afterwards. | |
| 37 | +BUILDER="sandbox-kit-builder" | |
| 38 | +if ! docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then | |
| 39 | + docker buildx create --name "${BUILDER}" --driver docker-container >/dev/null | |
| 40 | +fi | |
| 41 | + | |
| 42 | +# The descriptor (swift-toolchain.yaml) is passed as the "Dockerfile": its | |
| 43 | +# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds | |
| 44 | +# the overlay from swift-toolchain.dockerfile and packs the kit metadata with it. | |
| 45 | +docker buildx build "${KIT_DIR}" -f "${KIT_FILE}" \ | |
| 46 | + --builder "${BUILDER}" \ | |
| 47 | + --platform "${PLATFORMS}" \ | |
| 48 | + -t "${IMAGE}:${VERSION}" \ | |
| 49 | + -t "${IMAGE}:latest" \ | |
| 50 | + --push | |
| 51 | + | |
| 52 | +if [ "${SIGN:-0}" = "1" ]; then | |
| 53 | + sbx kit sign "${IMAGE}:${VERSION}" | |
| 54 | +fi | |
| 55 | + | |
| 56 | +echo "✅ Published ${IMAGE}:${VERSION}" | |
| 57 | +echo "💡 Try it: sbx run --name mm-demo docker.io/${NAMESPACE}/${REPO}:${VERSION} --kit ${IMAGE}:${VERSION}" | |
| new file mode 100755 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +: <<'COMMENT' | ||
| 3 | +Publish the swift-toolchain kit (a mixin) to Docker Hub as an OCI image. | ||
| 4 | +Doc: https://docs.docker.com/ai/sandboxes/customize/author/distribute/ | ||
| 5 | + | ||
| 6 | +1. docker login (once, with the Docker Hub account) | ||
| 7 | +2. Update TAG in release.env (shared with 01-release.tag.sh) | ||
| 8 | +3. Run this script: ./11-publish-swift-toolchain-kit.sh | ||
| 9 | + - DOCKER_HUB_NAMESPACE=foo ./11-publish-swift-toolchain-kit.sh to push under another namespace | ||
| 10 | + - SIGN=1 ./11-publish-swift-toolchain-kit.sh to sign the kit after the push | ||
| 11 | + (keyless, `sbx kit sign`) | ||
| 12 | + | ||
| 13 | +Then anyone can add it to a sandbox: | ||
| 14 | + sbx run --name mm-demo docker.io/<NAMESPACE>/mini-me-kit:<TAG> \ | ||
| 15 | + --kit docker.io/<NAMESPACE>/swift-toolchain-kit:<TAG> | ||
| 16 | +COMMENT | ||
| 17 | + | ||
| 18 | +set -euo pipefail | ||
| 19 | + | ||
| 20 | +set -o allexport | ||
| 21 | +source release.env | ||
| 22 | +set +o allexport | ||
| 23 | + | ||
| 24 | +NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}" | ||
| 25 | +KIT_DIR="./kits/swift-toolchain" | ||
| 26 | +KIT_FILE="${KIT_DIR}/swift-toolchain.yaml" | ||
| 27 | +# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2 | ||
| 28 | +VERSION="${TAG#v}" | ||
| 29 | +IMAGE="docker.io/${NAMESPACE}/swift-toolchain-kit" | ||
| 30 | +PLATFORMS="linux/amd64,linux/arm64" | ||
| 31 | + | ||
| 32 | +echo "Publishing ${IMAGE}:${VERSION} (and :latest) for ${PLATFORMS}" | ||
| 33 | + | ||
| 34 | +# A multi-platform push needs a builder that can do it: the default "docker" | ||
| 35 | +# driver cannot (unless the containerd image store is on), so use a | ||
| 36 | +# docker-container builder, created once and reused afterwards. | ||
| 37 | +BUILDER="sandbox-kit-builder" | ||
| 38 | +if ! docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then | ||
| 39 | + docker buildx create --name "${BUILDER}" --driver docker-container >/dev/null | ||
| 40 | +fi | ||
| 41 | + | ||
| 42 | +# The descriptor (swift-toolchain.yaml) is passed as the "Dockerfile": its | ||
| 43 | +# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds | ||
| 44 | +# the overlay from swift-toolchain.dockerfile and packs the kit metadata with it. | ||
| 45 | +docker buildx build "${KIT_DIR}" -f "${KIT_FILE}" \ | ||
| 46 | + --builder "${BUILDER}" \ | ||
| 47 | + --platform "${PLATFORMS}" \ | ||
| 48 | + -t "${IMAGE}:${VERSION}" \ | ||
| 49 | + -t "${IMAGE}:latest" \ | ||
| 50 | + --push | ||
| 51 | + | ||
| 52 | +if [ "${SIGN:-0}" = "1" ]; then | ||
| 53 | + sbx kit sign "${IMAGE}:${VERSION}" | ||
| 54 | +fi | ||
| 55 | + | ||
| 56 | +echo "✅ Published ${IMAGE}:${VERSION}" | ||
| 57 | +echo "💡 Try it: sbx run --name mm-demo docker.io/${NAMESPACE}/${REPO}:${VERSION} --kit ${IMAGE}:${VERSION}" | ||
added
12-publish-kotlin-toolchain-kit.sh +57 -0 | new file mode 100755 | ||
| @@ -0,0 +1,57 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +: <<'COMMENT' | |
| 3 | +Publish the kotlin-toolchain kit (a mixin) to Docker Hub as an OCI image. | |
| 4 | +Doc: https://docs.docker.com/ai/sandboxes/customize/author/distribute/ | |
| 5 | + | |
| 6 | +1. docker login (once, with the Docker Hub account) | |
| 7 | +2. Update TAG in release.env (shared with 01-release.tag.sh) | |
| 8 | +3. Run this script: ./12-publish-kotlin-toolchain-kit.sh | |
| 9 | + - DOCKER_HUB_NAMESPACE=foo ./12-publish-kotlin-toolchain-kit.sh to push under another namespace | |
| 10 | + - SIGN=1 ./12-publish-kotlin-toolchain-kit.sh to sign the kit after the push | |
| 11 | + (keyless, `sbx kit sign`) | |
| 12 | + | |
| 13 | +Then anyone can add it to a sandbox: | |
| 14 | + sbx run --name mm-demo docker.io/<NAMESPACE>/mini-me-kit:<TAG> \ | |
| 15 | + --kit docker.io/<NAMESPACE>/kotlin-toolchain-kit:<TAG> | |
| 16 | +COMMENT | |
| 17 | + | |
| 18 | +set -euo pipefail | |
| 19 | + | |
| 20 | +set -o allexport | |
| 21 | +source release.env | |
| 22 | +set +o allexport | |
| 23 | + | |
| 24 | +NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}" | |
| 25 | +KIT_DIR="./kits/kotlin-toolchain" | |
| 26 | +KIT_FILE="${KIT_DIR}/kotlin-toolchain.yaml" | |
| 27 | +# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2 | |
| 28 | +VERSION="${TAG#v}" | |
| 29 | +IMAGE="docker.io/${NAMESPACE}/kotlin-toolchain-kit" | |
| 30 | +PLATFORMS="linux/amd64,linux/arm64" | |
| 31 | + | |
| 32 | +echo "Publishing ${IMAGE}:${VERSION} (and :latest) for ${PLATFORMS}" | |
| 33 | + | |
| 34 | +# A multi-platform push needs a builder that can do it: the default "docker" | |
| 35 | +# driver cannot (unless the containerd image store is on), so use a | |
| 36 | +# docker-container builder, created once and reused afterwards. | |
| 37 | +BUILDER="sandbox-kit-builder" | |
| 38 | +if ! docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then | |
| 39 | + docker buildx create --name "${BUILDER}" --driver docker-container >/dev/null | |
| 40 | +fi | |
| 41 | + | |
| 42 | +# The descriptor (kotlin-toolchain.yaml) is passed as the "Dockerfile": its | |
| 43 | +# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds | |
| 44 | +# the overlay from kotlin-toolchain.dockerfile and packs the kit metadata with it. | |
| 45 | +docker buildx build "${KIT_DIR}" -f "${KIT_FILE}" \ | |
| 46 | + --builder "${BUILDER}" \ | |
| 47 | + --platform "${PLATFORMS}" \ | |
| 48 | + -t "${IMAGE}:${VERSION}" \ | |
| 49 | + -t "${IMAGE}:latest" \ | |
| 50 | + --push | |
| 51 | + | |
| 52 | +if [ "${SIGN:-0}" = "1" ]; then | |
| 53 | + sbx kit sign "${IMAGE}:${VERSION}" | |
| 54 | +fi | |
| 55 | + | |
| 56 | +echo "✅ Published ${IMAGE}:${VERSION}" | |
| 57 | +echo "💡 Try it: sbx run --name mm-demo docker.io/${NAMESPACE}/${REPO}:${VERSION} --kit ${IMAGE}:${VERSION}" | |
| new file mode 100755 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | +#!/bin/bash | ||
| 2 | +: <<'COMMENT' | ||
| 3 | +Publish the kotlin-toolchain kit (a mixin) to Docker Hub as an OCI image. | ||
| 4 | +Doc: https://docs.docker.com/ai/sandboxes/customize/author/distribute/ | ||
| 5 | + | ||
| 6 | +1. docker login (once, with the Docker Hub account) | ||
| 7 | +2. Update TAG in release.env (shared with 01-release.tag.sh) | ||
| 8 | +3. Run this script: ./12-publish-kotlin-toolchain-kit.sh | ||
| 9 | + - DOCKER_HUB_NAMESPACE=foo ./12-publish-kotlin-toolchain-kit.sh to push under another namespace | ||
| 10 | + - SIGN=1 ./12-publish-kotlin-toolchain-kit.sh to sign the kit after the push | ||
| 11 | + (keyless, `sbx kit sign`) | ||
| 12 | + | ||
| 13 | +Then anyone can add it to a sandbox: | ||
| 14 | + sbx run --name mm-demo docker.io/<NAMESPACE>/mini-me-kit:<TAG> \ | ||
| 15 | + --kit docker.io/<NAMESPACE>/kotlin-toolchain-kit:<TAG> | ||
| 16 | +COMMENT | ||
| 17 | + | ||
| 18 | +set -euo pipefail | ||
| 19 | + | ||
| 20 | +set -o allexport | ||
| 21 | +source release.env | ||
| 22 | +set +o allexport | ||
| 23 | + | ||
| 24 | +NAMESPACE="${DOCKER_HUB_NAMESPACE:-k33g}" | ||
| 25 | +KIT_DIR="./kits/kotlin-toolchain" | ||
| 26 | +KIT_FILE="${KIT_DIR}/kotlin-toolchain.yaml" | ||
| 27 | +# Docker Hub tags are usually written without the leading "v": v0.0.2 -> 0.0.2 | ||
| 28 | +VERSION="${TAG#v}" | ||
| 29 | +IMAGE="docker.io/${NAMESPACE}/kotlin-toolchain-kit" | ||
| 30 | +PLATFORMS="linux/amd64,linux/arm64" | ||
| 31 | + | ||
| 32 | +echo "Publishing ${IMAGE}:${VERSION} (and :latest) for ${PLATFORMS}" | ||
| 33 | + | ||
| 34 | +# A multi-platform push needs a builder that can do it: the default "docker" | ||
| 35 | +# driver cannot (unless the containerd image store is on), so use a | ||
| 36 | +# docker-container builder, created once and reused afterwards. | ||
| 37 | +BUILDER="sandbox-kit-builder" | ||
| 38 | +if ! docker buildx inspect "${BUILDER}" >/dev/null 2>&1; then | ||
| 39 | + docker buildx create --name "${BUILDER}" --driver docker-container >/dev/null | ||
| 40 | +fi | ||
| 41 | + | ||
| 42 | +# The descriptor (kotlin-toolchain.yaml) is passed as the "Dockerfile": its | ||
| 43 | +# `# syntax=docker/sandbox-kit:3` line selects the kit frontend, which builds | ||
| 44 | +# the overlay from kotlin-toolchain.dockerfile and packs the kit metadata with it. | ||
| 45 | +docker buildx build "${KIT_DIR}" -f "${KIT_FILE}" \ | ||
| 46 | + --builder "${BUILDER}" \ | ||
| 47 | + --platform "${PLATFORMS}" \ | ||
| 48 | + -t "${IMAGE}:${VERSION}" \ | ||
| 49 | + -t "${IMAGE}:latest" \ | ||
| 50 | + --push | ||
| 51 | + | ||
| 52 | +if [ "${SIGN:-0}" = "1" ]; then | ||
| 53 | + sbx kit sign "${IMAGE}:${VERSION}" | ||
| 54 | +fi | ||
| 55 | + | ||
| 56 | +echo "✅ Published ${IMAGE}:${VERSION}" | ||
| 57 | +echo "💡 Try it: sbx run --name mm-demo docker.io/${NAMESPACE}/${REPO}:${VERSION} --kit ${IMAGE}:${VERSION}" | ||
modified
README.md +4 -0 | @@ -119,6 +119,8 @@ Add them to any of the kits above with `--kit`: | ||
| 119 | 119 | | `./kits/go-toolchain` | `go`, `gofmt`, `gopls` | `go_version` | |
| 120 | 120 | | `./kits/rust-toolchain` | `cargo`, `rustc`, `rustfmt`, `clippy`, `rust-analyzer`, plus `gcc` (linker, C build scripts) | `rust_version` | |
| 121 | 121 | | `./kits/python-toolchain` | `python3`, `pip`, `uv`, `uvx`, `ruff`, `ty`, `basedpyright` (standalone CPython, tools installed with uv) | `python_version`, `uv_version` (+ `ruff_version`, `ty_version`, `basedpyright_version`: `none` to leave one out) | |
| 122 | +| `./kits/swift-toolchain` | `swift`, `swiftc`, SwiftPM (`swift build/test/run/package`), `swift-format`, `lldb`, `sourcekit-lsp`, plus the system packages it needs (binutils, libc / libstdc++ headers, libcurl, libxml2…) — the toolchain matches the workload distro (Ubuntu / Debian), about 3.5 GB | `swift_version` | | |
| 123 | +| `./kits/kotlin-toolchain` | `kotlinc`, `kotlin`, JDK (`java`, `javac`, `jshell`…, Eclipse Temurin), `gradle`, `ktlint`, `kotlin-lsp` | `kotlin_version`, `jdk_version` (+ `gradle_version`, `ktlint_version`, `kotlin_lsp_version`: `none` to leave one out; kotlin-lsp is about 1.2 GB) | | |
| 122 | 124 | | `./kits/nushell` | `nu` (static binary) | `nushell_version` | |
| 123 | 125 | |
| 124 | 126 | ```bash |
| @@ -206,6 +208,8 @@ sbx env rm | ||
| 206 | 208 | ./08-publish-vscode-ssh-kit.sh # ./kits/vscode-ssh -> k33g/vscode-ssh-kit |
| 207 | 209 | ./09-publish-zed-ssh-kit.sh # ./kits/zed-ssh -> k33g/zed-ssh-kit |
| 208 | 210 | ./10-publish-python-toolchain-kit.sh # ./kits/python-toolchain -> k33g/python-toolchain-kit |
| 211 | + ./11-publish-swift-toolchain-kit.sh # ./kits/swift-toolchain -> k33g/swift-toolchain-kit | |
| 212 | + ./12-publish-kotlin-toolchain-kit.sh # ./kits/kotlin-toolchain -> k33g/kotlin-toolchain-kit | |
| 209 | 213 | ``` |
| 210 | 214 | - `DOCKER_HUB_NAMESPACE=<namespace>` to push under another namespace (default: `k33g`) |
| 211 | 215 | - `SIGN=1` to sign the kit after the push (`sbx kit sign`) |
| @@ -119,6 +119,8 @@ Add them to any of the kits above with `--kit`: | |||
| 119 | | `./kits/go-toolchain` | `go`, `gofmt`, `gopls` | `go_version` | | 119 | | `./kits/go-toolchain` | `go`, `gofmt`, `gopls` | `go_version` | |
| 120 | | `./kits/rust-toolchain` | `cargo`, `rustc`, `rustfmt`, `clippy`, `rust-analyzer`, plus `gcc` (linker, C build scripts) | `rust_version` | | 120 | | `./kits/rust-toolchain` | `cargo`, `rustc`, `rustfmt`, `clippy`, `rust-analyzer`, plus `gcc` (linker, C build scripts) | `rust_version` | |
| 121 | | `./kits/python-toolchain` | `python3`, `pip`, `uv`, `uvx`, `ruff`, `ty`, `basedpyright` (standalone CPython, tools installed with uv) | `python_version`, `uv_version` (+ `ruff_version`, `ty_version`, `basedpyright_version`: `none` to leave one out) | | 121 | | `./kits/python-toolchain` | `python3`, `pip`, `uv`, `uvx`, `ruff`, `ty`, `basedpyright` (standalone CPython, tools installed with uv) | `python_version`, `uv_version` (+ `ruff_version`, `ty_version`, `basedpyright_version`: `none` to leave one out) | |
| 122 | +| `./kits/swift-toolchain` | `swift`, `swiftc`, SwiftPM (`swift build/test/run/package`), `swift-format`, `lldb`, `sourcekit-lsp`, plus the system packages it needs (binutils, libc / libstdc++ headers, libcurl, libxml2…) — the toolchain matches the workload distro (Ubuntu / Debian), about 3.5 GB | `swift_version` | | ||
| 123 | +| `./kits/kotlin-toolchain` | `kotlinc`, `kotlin`, JDK (`java`, `javac`, `jshell`…, Eclipse Temurin), `gradle`, `ktlint`, `kotlin-lsp` | `kotlin_version`, `jdk_version` (+ `gradle_version`, `ktlint_version`, `kotlin_lsp_version`: `none` to leave one out; kotlin-lsp is about 1.2 GB) | | ||
| 122 | | `./kits/nushell` | `nu` (static binary) | `nushell_version` | | 124 | | `./kits/nushell` | `nu` (static binary) | `nushell_version` | |
| 123 | 125 | ||
| 124 | ```bash | 126 | ```bash |
| @@ -206,6 +208,8 @@ sbx env rm | |||
| 206 | ./08-publish-vscode-ssh-kit.sh # ./kits/vscode-ssh -> k33g/vscode-ssh-kit | 208 | ./08-publish-vscode-ssh-kit.sh # ./kits/vscode-ssh -> k33g/vscode-ssh-kit |
| 207 | ./09-publish-zed-ssh-kit.sh # ./kits/zed-ssh -> k33g/zed-ssh-kit | 209 | ./09-publish-zed-ssh-kit.sh # ./kits/zed-ssh -> k33g/zed-ssh-kit |
| 208 | ./10-publish-python-toolchain-kit.sh # ./kits/python-toolchain -> k33g/python-toolchain-kit | 210 | ./10-publish-python-toolchain-kit.sh # ./kits/python-toolchain -> k33g/python-toolchain-kit |
| 211 | + ./11-publish-swift-toolchain-kit.sh # ./kits/swift-toolchain -> k33g/swift-toolchain-kit | ||
| 212 | + ./12-publish-kotlin-toolchain-kit.sh # ./kits/kotlin-toolchain -> k33g/kotlin-toolchain-kit | ||
| 209 | ``` | 213 | ``` |
| 210 | - `DOCKER_HUB_NAMESPACE=<namespace>` to push under another namespace (default: `k33g`) | 214 | - `DOCKER_HUB_NAMESPACE=<namespace>` to push under another namespace (default: `k33g`) |
| 211 | - `SIGN=1` to sign the kit after the push (`sbx kit sign`) | 215 | - `SIGN=1` to sign the kit after the push (`sbx kit sign`) |
added
kits/kotlin-toolchain/kotlin-context.md +11 -0 | new file mode 100644 | ||
| @@ -0,0 +1,11 @@ | ||
| 1 | +## Kotlin | |
| 2 | + | |
| 3 | +`kotlinc`, `kotlin`, a JDK (`java`, `javac`, `jar`, `jshell`; Eclipse Temurin | |
| 4 | +in `/usr/local/jdk`), `gradle`, `ktlint` and `kotlin-lsp` are installed | |
| 5 | +(`/usr/local`). In a Gradle project, prefer its wrapper (`./gradlew build`, | |
| 6 | +`./gradlew test`) over `gradle`; run the build and the tests before reporting | |
| 7 | +a task complete, and `ktlint` (`ktlint --format` to fix) on the Kotlin | |
| 8 | +sources. Prefer `kotlin-lsp --stdio` for navigation and refactoring | |
| 9 | +(definitions, references, rename) over text search. Dependencies come from | |
| 10 | +Maven Central, the Gradle plugin portal and Google's Maven repository; other | |
| 11 | +hosts may be blocked. | |
| new file mode 100644 | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | +## Kotlin | ||
| 2 | + | ||
| 3 | +`kotlinc`, `kotlin`, a JDK (`java`, `javac`, `jar`, `jshell`; Eclipse Temurin | ||
| 4 | +in `/usr/local/jdk`), `gradle`, `ktlint` and `kotlin-lsp` are installed | ||
| 5 | +(`/usr/local`). In a Gradle project, prefer its wrapper (`./gradlew build`, | ||
| 6 | +`./gradlew test`) over `gradle`; run the build and the tests before reporting | ||
| 7 | +a task complete, and `ktlint` (`ktlint --format` to fix) on the Kotlin | ||
| 8 | +sources. Prefer `kotlin-lsp --stdio` for navigation and refactoring | ||
| 9 | +(definitions, references, rename) over text search. Dependencies come from | ||
| 10 | +Maven Central, the Gradle plugin portal and Google's Maven repository; other | ||
| 11 | +hosts may be blocked. | ||
added
kits/kotlin-toolchain/kotlin-toolchain.dockerfile +94 -0 | new file mode 100644 | ||
| @@ -0,0 +1,94 @@ | ||
| 1 | +# syntax=docker/dockerfile:1 | |
| 2 | + | |
| 3 | +ARG JDK_VERSION=25 | |
| 4 | + | |
| 5 | +# --- JDK: Eclipse Temurin, from its official image --------------------------- | |
| 6 | +# A self-contained JDK that only needs glibc: it does not depend on the | |
| 7 | +# workload distro (and takes precedence over a JDK the workload may have). | |
| 8 | +FROM eclipse-temurin:${JDK_VERSION}-jdk AS jdk | |
| 9 | + | |
| 10 | +# --- build stage: kotlinc, Gradle, ktlint and kotlin-lsp --------------------- | |
| 11 | +FROM debian:trixie-slim AS build | |
| 12 | +ARG KOTLIN_VERSION | |
| 13 | +ARG GRADLE_VERSION | |
| 14 | +ARG KTLINT_VERSION | |
| 15 | +ARG KOTLIN_LSP_VERSION | |
| 16 | +ARG TARGETARCH | |
| 17 | + | |
| 18 | +# A heredoc RUN does not stop at the first failing line by itself: every | |
| 19 | +# script starts with `set -eu`. | |
| 20 | +RUN <<EOF | |
| 21 | +set -eu | |
| 22 | +apt-get update | |
| 23 | +apt-get install -y --no-install-recommends curl ca-certificates unzip | |
| 24 | +rm -rf /var/lib/apt/lists/* | |
| 25 | +EOF | |
| 26 | + | |
| 27 | +# Everything is installed at the path it has on the workload, under | |
| 28 | +# /out/usr/local, and linked from /usr/local/bin. The launch scripts | |
| 29 | +# (java, kotlinc, gradle, ktlint) find their home from their real path. | |
| 30 | +COPY --from=jdk /opt/java/openjdk /out/usr/local/jdk | |
| 31 | +RUN <<EOF | |
| 32 | +set -eu | |
| 33 | +mkdir -p /out/usr/local/bin | |
| 34 | +for bin in java javac jar jshell javadoc javap jdeps jlink jcmd jstack jfr keytool; do | |
| 35 | + [ -e "/out/usr/local/jdk/bin/${bin}" ] || continue | |
| 36 | + ln -s "/usr/local/jdk/bin/${bin}" "/out/usr/local/bin/${bin}" | |
| 37 | +done | |
| 38 | +EOF | |
| 39 | + | |
| 40 | +RUN <<EOF | |
| 41 | +set -eu | |
| 42 | +curl -fsSL -o /tmp/kotlinc.zip \ | |
| 43 | + "https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip" | |
| 44 | +unzip -q /tmp/kotlinc.zip -d /tmp | |
| 45 | +mv /tmp/kotlinc /out/usr/local/kotlinc | |
| 46 | +rm /tmp/kotlinc.zip | |
| 47 | +for bin in kotlin kotlinc kotlinc-jvm; do | |
| 48 | + ln -s "/usr/local/kotlinc/bin/${bin}" "/out/usr/local/bin/${bin}" | |
| 49 | +done | |
| 50 | +EOF | |
| 51 | + | |
| 52 | +# `none` leaves a tool out. | |
| 53 | +RUN <<EOF | |
| 54 | +set -eu | |
| 55 | +if [ "${GRADLE_VERSION}" != "none" ]; then | |
| 56 | + curl -fsSL -o /tmp/gradle.zip \ | |
| 57 | + "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" | |
| 58 | + unzip -q /tmp/gradle.zip -d /tmp | |
| 59 | + mv "/tmp/gradle-${GRADLE_VERSION}" /out/usr/local/gradle | |
| 60 | + rm /tmp/gradle.zip | |
| 61 | + ln -s /usr/local/gradle/bin/gradle /out/usr/local/bin/gradle | |
| 62 | +fi | |
| 63 | +if [ "${KTLINT_VERSION}" != "none" ]; then | |
| 64 | + # A self-executing jar: it runs with the `java` on the PATH. | |
| 65 | + curl -fsSL -o /out/usr/local/bin/ktlint \ | |
| 66 | + "https://github.com/ktlint/ktlint/releases/download/${KTLINT_VERSION}/ktlint" | |
| 67 | + chmod +x /out/usr/local/bin/ktlint | |
| 68 | +fi | |
| 69 | +EOF | |
| 70 | + | |
| 71 | +# kotlin-lsp ships with its own JetBrains Runtime (jbr/): it does not use the | |
| 72 | +# JDK above. The launcher is a native binary, called through a small script. | |
| 73 | +RUN <<EOF | |
| 74 | +set -eu | |
| 75 | +[ "${KOTLIN_LSP_VERSION}" = "none" ] && exit 0 | |
| 76 | +case "${TARGETARCH}" in | |
| 77 | + amd64) suffix="" ;; | |
| 78 | + arm64) suffix="-aarch64" ;; | |
| 79 | + *) echo "unsupported arch: ${TARGETARCH}" >&2; exit 1 ;; | |
| 80 | +esac | |
| 81 | +mkdir -p /out/usr/local/kotlin-lsp | |
| 82 | +curl -fsSL \ | |
| 83 | + "https://download.jetbrains.com/language-server/kotlin-server/${KOTLIN_LSP_VERSION}/kotlin-server-${KOTLIN_LSP_VERSION}${suffix}.tar.gz" \ | |
| 84 | + | tar -C /out/usr/local/kotlin-lsp -xz --strip-components=1 | |
| 85 | +cat > /out/usr/local/bin/kotlin-lsp <<'SH' | |
| 86 | +#!/bin/sh | |
| 87 | +exec /usr/local/kotlin-lsp/bin/intellij-server "$@" | |
| 88 | +SH | |
| 89 | +chmod +x /out/usr/local/bin/kotlin-lsp | |
| 90 | +EOF | |
| 91 | + | |
| 92 | +# --- overlay: only the toolchains and their links land ---------------------- | |
| 93 | +FROM scratch | |
| 94 | +COPY --from=build /out/ / | |
| new file mode 100644 | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | +# syntax=docker/dockerfile:1 | ||
| 2 | + | ||
| 3 | +ARG JDK_VERSION=25 | ||
| 4 | + | ||
| 5 | +# --- JDK: Eclipse Temurin, from its official image --------------------------- | ||
| 6 | +# A self-contained JDK that only needs glibc: it does not depend on the | ||
| 7 | +# workload distro (and takes precedence over a JDK the workload may have). | ||
| 8 | +FROM eclipse-temurin:${JDK_VERSION}-jdk AS jdk | ||
| 9 | + | ||
| 10 | +# --- build stage: kotlinc, Gradle, ktlint and kotlin-lsp --------------------- | ||
| 11 | +FROM debian:trixie-slim AS build | ||
| 12 | +ARG KOTLIN_VERSION | ||
| 13 | +ARG GRADLE_VERSION | ||
| 14 | +ARG KTLINT_VERSION | ||
| 15 | +ARG KOTLIN_LSP_VERSION | ||
| 16 | +ARG TARGETARCH | ||
| 17 | + | ||
| 18 | +# A heredoc RUN does not stop at the first failing line by itself: every | ||
| 19 | +# script starts with `set -eu`. | ||
| 20 | +RUN <<EOF | ||
| 21 | +set -eu | ||
| 22 | +apt-get update | ||
| 23 | +apt-get install -y --no-install-recommends curl ca-certificates unzip | ||
| 24 | +rm -rf /var/lib/apt/lists/* | ||
| 25 | +EOF | ||
| 26 | + | ||
| 27 | +# Everything is installed at the path it has on the workload, under | ||
| 28 | +# /out/usr/local, and linked from /usr/local/bin. The launch scripts | ||
| 29 | +# (java, kotlinc, gradle, ktlint) find their home from their real path. | ||
| 30 | +COPY --from=jdk /opt/java/openjdk /out/usr/local/jdk | ||
| 31 | +RUN <<EOF | ||
| 32 | +set -eu | ||
| 33 | +mkdir -p /out/usr/local/bin | ||
| 34 | +for bin in java javac jar jshell javadoc javap jdeps jlink jcmd jstack jfr keytool; do | ||
| 35 | + [ -e "/out/usr/local/jdk/bin/${bin}" ] || continue | ||
| 36 | + ln -s "/usr/local/jdk/bin/${bin}" "/out/usr/local/bin/${bin}" | ||
| 37 | +done | ||
| 38 | +EOF | ||
| 39 | + | ||
| 40 | +RUN <<EOF | ||
| 41 | +set -eu | ||
| 42 | +curl -fsSL -o /tmp/kotlinc.zip \ | ||
| 43 | + "https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip" | ||
| 44 | +unzip -q /tmp/kotlinc.zip -d /tmp | ||
| 45 | +mv /tmp/kotlinc /out/usr/local/kotlinc | ||
| 46 | +rm /tmp/kotlinc.zip | ||
| 47 | +for bin in kotlin kotlinc kotlinc-jvm; do | ||
| 48 | + ln -s "/usr/local/kotlinc/bin/${bin}" "/out/usr/local/bin/${bin}" | ||
| 49 | +done | ||
| 50 | +EOF | ||
| 51 | + | ||
| 52 | +# `none` leaves a tool out. | ||
| 53 | +RUN <<EOF | ||
| 54 | +set -eu | ||
| 55 | +if [ "${GRADLE_VERSION}" != "none" ]; then | ||
| 56 | + curl -fsSL -o /tmp/gradle.zip \ | ||
| 57 | + "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" | ||
| 58 | + unzip -q /tmp/gradle.zip -d /tmp | ||
| 59 | + mv "/tmp/gradle-${GRADLE_VERSION}" /out/usr/local/gradle | ||
| 60 | + rm /tmp/gradle.zip | ||
| 61 | + ln -s /usr/local/gradle/bin/gradle /out/usr/local/bin/gradle | ||
| 62 | +fi | ||
| 63 | +if [ "${KTLINT_VERSION}" != "none" ]; then | ||
| 64 | + # A self-executing jar: it runs with the `java` on the PATH. | ||
| 65 | + curl -fsSL -o /out/usr/local/bin/ktlint \ | ||
| 66 | + "https://github.com/ktlint/ktlint/releases/download/${KTLINT_VERSION}/ktlint" | ||
| 67 | + chmod +x /out/usr/local/bin/ktlint | ||
| 68 | +fi | ||
| 69 | +EOF | ||
| 70 | + | ||
| 71 | +# kotlin-lsp ships with its own JetBrains Runtime (jbr/): it does not use the | ||
| 72 | +# JDK above. The launcher is a native binary, called through a small script. | ||
| 73 | +RUN <<EOF | ||
| 74 | +set -eu | ||
| 75 | +[ "${KOTLIN_LSP_VERSION}" = "none" ] && exit 0 | ||
| 76 | +case "${TARGETARCH}" in | ||
| 77 | + amd64) suffix="" ;; | ||
| 78 | + arm64) suffix="-aarch64" ;; | ||
| 79 | + *) echo "unsupported arch: ${TARGETARCH}" >&2; exit 1 ;; | ||
| 80 | +esac | ||
| 81 | +mkdir -p /out/usr/local/kotlin-lsp | ||
| 82 | +curl -fsSL \ | ||
| 83 | + "https://download.jetbrains.com/language-server/kotlin-server/${KOTLIN_LSP_VERSION}/kotlin-server-${KOTLIN_LSP_VERSION}${suffix}.tar.gz" \ | ||
| 84 | + | tar -C /out/usr/local/kotlin-lsp -xz --strip-components=1 | ||
| 85 | +cat > /out/usr/local/bin/kotlin-lsp <<'SH' | ||
| 86 | +#!/bin/sh | ||
| 87 | +exec /usr/local/kotlin-lsp/bin/intellij-server "$@" | ||
| 88 | +SH | ||
| 89 | +chmod +x /out/usr/local/bin/kotlin-lsp | ||
| 90 | +EOF | ||
| 91 | + | ||
| 92 | +# --- overlay: only the toolchains and their links land ---------------------- | ||
| 93 | +FROM scratch | ||
| 94 | +COPY --from=build /out/ / | ||
added
kits/kotlin-toolchain/kotlin-toolchain.yaml +59 -0 | new file mode 100644 | ||
| @@ -0,0 +1,59 @@ | ||
| 1 | +# syntax=docker/sandbox-kit:3 | |
| 2 | +schemaVersion: "3" | |
| 3 | +kind: mixin | |
| 4 | +displayName: Kotlin toolchain | |
| 5 | +description: Kotlin compiler (kotlinc, kotlin), JDK (Eclipse Temurin), Gradle, ktlint (linter, formatter) and kotlin-lsp (language server) | |
| 6 | + | |
| 7 | +licenses: [MIT] | |
| 8 | +version: "1.3.0" | |
| 9 | + | |
| 10 | +args: | |
| 11 | + kotlin_version: | |
| 12 | + # A release of https://github.com/JetBrains/kotlin/releases (no leading "v"). | |
| 13 | + default: "2.4.21" | |
| 14 | + pattern: '^[0-9]+\.[0-9]+\.[0-9]+$' | |
| 15 | + buildArg: KOTLIN_VERSION | |
| 16 | + jdk_version: | |
| 17 | + # An Eclipse Temurin feature release (e.g. 21, 25): the eclipse-temurin:<n>-jdk image. | |
| 18 | + default: "25" | |
| 19 | + pattern: '^[0-9]+$' | |
| 20 | + buildArg: JDK_VERSION | |
| 21 | + gradle_version: | |
| 22 | + # A Gradle release (e.g. 9.9.1), or `none` to leave it out (projects with a wrapper do not need it). | |
| 23 | + default: "9.9.1" | |
| 24 | + pattern: '^(none|[0-9]+\.[0-9]+(\.[0-9]+)?)$' | |
| 25 | + buildArg: GRADLE_VERSION | |
| 26 | + ktlint_version: | |
| 27 | + # A release of https://github.com/ktlint/ktlint/releases, or `none` to leave it out. | |
| 28 | + default: "1.8.0" | |
| 29 | + pattern: '^(none|[0-9]+\.[0-9]+\.[0-9]+)$' | |
| 30 | + buildArg: KTLINT_VERSION | |
| 31 | + kotlin_lsp_version: | |
| 32 | + # A release of https://github.com/Kotlin/kotlin-lsp/releases (e.g. 263.7084.0), | |
| 33 | + # or `none` to leave it out: it bundles its own JetBrains Runtime (about 1.2 GB). | |
| 34 | + default: "263.7084.0" | |
| 35 | + pattern: '^(none|[0-9]+\.[0-9]+\.[0-9]+)$' | |
| 36 | + buildArg: KOTLIN_LSP_VERSION | |
| 37 | + | |
| 38 | +provides: ["kotlin@${{ kit.args.kotlin_version }}", "java@${{ kit.args.jdk_version }}"] | |
| 39 | + | |
| 40 | +capabilities: | |
| 41 | + # Runtime access with the tool: Maven Central, the Gradle plugin portal and | |
| 42 | + # distributions (wrapper downloads), Google's Maven repository (Android). | |
| 43 | + # Add private repositories here (or in a kit set) if you need them. | |
| 44 | + - type: com.docker.sandbox/network-policy@1 | |
| 45 | + config: | |
| 46 | + runtime: | |
| 47 | + allow: | |
| 48 | + - repo.maven.apache.org | |
| 49 | + - repo1.maven.org | |
| 50 | + - plugins.gradle.org | |
| 51 | + - plugins-artifacts.gradle.org | |
| 52 | + - services.gradle.org | |
| 53 | + - downloads.gradle.org | |
| 54 | + - dl.google.com | |
| 55 | + - maven.google.com | |
| 56 | + - github.com | |
| 57 | + # - type: com.docker.sandbox/agent-context@1 | |
| 58 | + # config: | |
| 59 | + # contentFile: ./kotlin-context.md | |
| new file mode 100644 | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | +# syntax=docker/sandbox-kit:3 | ||
| 2 | +schemaVersion: "3" | ||
| 3 | +kind: mixin | ||
| 4 | +displayName: Kotlin toolchain | ||
| 5 | +description: Kotlin compiler (kotlinc, kotlin), JDK (Eclipse Temurin), Gradle, ktlint (linter, formatter) and kotlin-lsp (language server) | ||
| 6 | + | ||
| 7 | +licenses: [MIT] | ||
| 8 | +version: "1.3.0" | ||
| 9 | + | ||
| 10 | +args: | ||
| 11 | + kotlin_version: | ||
| 12 | + # A release of https://github.com/JetBrains/kotlin/releases (no leading "v"). | ||
| 13 | + default: "2.4.21" | ||
| 14 | + pattern: '^[0-9]+\.[0-9]+\.[0-9]+$' | ||
| 15 | + buildArg: KOTLIN_VERSION | ||
| 16 | + jdk_version: | ||
| 17 | + # An Eclipse Temurin feature release (e.g. 21, 25): the eclipse-temurin:<n>-jdk image. | ||
| 18 | + default: "25" | ||
| 19 | + pattern: '^[0-9]+$' | ||
| 20 | + buildArg: JDK_VERSION | ||
| 21 | + gradle_version: | ||
| 22 | + # A Gradle release (e.g. 9.9.1), or `none` to leave it out (projects with a wrapper do not need it). | ||
| 23 | + default: "9.9.1" | ||
| 24 | + pattern: '^(none|[0-9]+\.[0-9]+(\.[0-9]+)?)$' | ||
| 25 | + buildArg: GRADLE_VERSION | ||
| 26 | + ktlint_version: | ||
| 27 | + # A release of https://github.com/ktlint/ktlint/releases, or `none` to leave it out. | ||
| 28 | + default: "1.8.0" | ||
| 29 | + pattern: '^(none|[0-9]+\.[0-9]+\.[0-9]+)$' | ||
| 30 | + buildArg: KTLINT_VERSION | ||
| 31 | + kotlin_lsp_version: | ||
| 32 | + # A release of https://github.com/Kotlin/kotlin-lsp/releases (e.g. 263.7084.0), | ||
| 33 | + # or `none` to leave it out: it bundles its own JetBrains Runtime (about 1.2 GB). | ||
| 34 | + default: "263.7084.0" | ||
| 35 | + pattern: '^(none|[0-9]+\.[0-9]+\.[0-9]+)$' | ||
| 36 | + buildArg: KOTLIN_LSP_VERSION | ||
| 37 | + | ||
| 38 | +provides: ["kotlin@${{ kit.args.kotlin_version }}", "java@${{ kit.args.jdk_version }}"] | ||
| 39 | + | ||
| 40 | +capabilities: | ||
| 41 | + # Runtime access with the tool: Maven Central, the Gradle plugin portal and | ||
| 42 | + # distributions (wrapper downloads), Google's Maven repository (Android). | ||
| 43 | + # Add private repositories here (or in a kit set) if you need them. | ||
| 44 | + - type: com.docker.sandbox/network-policy@1 | ||
| 45 | + config: | ||
| 46 | + runtime: | ||
| 47 | + allow: | ||
| 48 | + - repo.maven.apache.org | ||
| 49 | + - repo1.maven.org | ||
| 50 | + - plugins.gradle.org | ||
| 51 | + - plugins-artifacts.gradle.org | ||
| 52 | + - services.gradle.org | ||
| 53 | + - downloads.gradle.org | ||
| 54 | + - dl.google.com | ||
| 55 | + - maven.google.com | ||
| 56 | + - github.com | ||
| 57 | + # - type: com.docker.sandbox/agent-context@1 | ||
| 58 | + # config: | ||
| 59 | + # contentFile: ./kotlin-context.md | ||
added
kits/swift-toolchain/swift-context.md +10 -0 | new file mode 100644 | ||
| @@ -0,0 +1,10 @@ | ||
| 1 | +## Swift | |
| 2 | + | |
| 3 | +`swift`, `swiftc`, the Swift Package Manager (`swift build`, `swift test`, | |
| 4 | +`swift run`, `swift package`), `swift-format`, `lldb` and `sourcekit-lsp` are | |
| 5 | +installed (`/usr/local/swift`). Run `swift build` and `swift test` before | |
| 6 | +reporting a task complete; format with `swift format --in-place --recursive Sources Tests`. | |
| 7 | +Prefer `sourcekit-lsp` for navigation and refactoring (definitions, | |
| 8 | +references, rename) over text search. There is no `swiftly`: the toolchain | |
| 9 | +version is fixed by the kit. Packages are fetched with git, mostly from | |
| 10 | +GitHub; other hosts may be blocked. | |
| new file mode 100644 | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | +## Swift | ||
| 2 | + | ||
| 3 | +`swift`, `swiftc`, the Swift Package Manager (`swift build`, `swift test`, | ||
| 4 | +`swift run`, `swift package`), `swift-format`, `lldb` and `sourcekit-lsp` are | ||
| 5 | +installed (`/usr/local/swift`). Run `swift build` and `swift test` before | ||
| 6 | +reporting a task complete; format with `swift format --in-place --recursive Sources Tests`. | ||
| 7 | +Prefer `sourcekit-lsp` for navigation and refactoring (definitions, | ||
| 8 | +references, rename) over text search. There is no `swiftly`: the toolchain | ||
| 9 | +version is fixed by the kit. Packages are fetched with git, mostly from | ||
| 10 | +GitHub; other hosts may be blocked. | ||
added
kits/swift-toolchain/swift-toolchain.dockerfile +79 -0 | new file mode 100644 | ||
| @@ -0,0 +1,79 @@ | ||
| 1 | +# syntax=docker/dockerfile:1 | |
| 2 | + | |
| 3 | +# --- build stage: on the workload image itself ------------------------------- | |
| 4 | +# Swift ships one toolchain per distro release, linked against that release's | |
| 5 | +# libraries: the tarball is chosen from the workload's /etc/os-release, and the | |
| 6 | +# system packages it needs are taken from that same release (as .deb files | |
| 7 | +# unpacked into the overlay), so everything matches what is already installed. | |
| 8 | +FROM docker/sandbox-templates:shell AS build | |
| 9 | +USER root | |
| 10 | +ARG SWIFT_VERSION | |
| 11 | +ARG TARGETARCH | |
| 12 | + | |
| 13 | +# A heredoc RUN does not stop at the first failing line by itself: every | |
| 14 | +# script starts with `set -eu`. | |
| 15 | + | |
| 16 | +# What the toolchain needs at run time (from swift.org's Linux dependencies): | |
| 17 | +# the linker and C/C++ runtime headers (binutils, libc6-dev, g++ for | |
| 18 | +# libstdc++-dev), Foundation's (libcurl, libxml2), the REPL / lldb ones | |
| 19 | +# (libedit, libncurses, libpython3) and SwiftPM's (libsqlite3, pkg-config). | |
| 20 | +# Packages the workload already has are not downloaded, so not overlaid. | |
| 21 | +RUN <<EOF | |
| 22 | +set -eu | |
| 23 | +apt-get update | |
| 24 | +apt-get install -y --no-install-recommends --download-only \ | |
| 25 | + binutils libc6-dev g++ \ | |
| 26 | + libcurl4-openssl-dev libxml2-dev zlib1g-dev \ | |
| 27 | + libedit2 libncurses-dev libpython3-dev \ | |
| 28 | + libsqlite3-0 pkg-config tzdata | |
| 29 | +mkdir -p /out | |
| 30 | +for deb in /var/cache/apt/archives/*.deb; do | |
| 31 | + [ -e "${deb}" ] || continue | |
| 32 | + dpkg-deb -x "${deb}" /out | |
| 33 | +done | |
| 34 | +# Set by update-alternatives in a real install, which unpacking skips. | |
| 35 | +if [ -e /out/usr/bin/gcc ]; then | |
| 36 | + ln -sf gcc /out/usr/bin/cc | |
| 37 | +fi | |
| 38 | +if [ -e /out/usr/bin/g++ ]; then | |
| 39 | + ln -sf g++ /out/usr/bin/c++ | |
| 40 | +fi | |
| 41 | +rm -rf /out/usr/share/doc /out/usr/share/man /out/usr/share/info /out/usr/share/locale | |
| 42 | +rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*.deb | |
| 43 | +EOF | |
| 44 | + | |
| 45 | +# The toolchain, kept in one tree (/usr/local/swift) so it does not mix with | |
| 46 | +# the workload's /usr: its binaries find their libraries and resources from | |
| 47 | +# their real path, through the links in /usr/local/bin. | |
| 48 | +RUN <<EOF | |
| 49 | +set -eu | |
| 50 | +. /etc/os-release | |
| 51 | +case "${ID}" in | |
| 52 | + ubuntu) platform="ubuntu${VERSION_ID}" ;; | |
| 53 | + debian) platform="debian${VERSION_ID}" ;; | |
| 54 | + *) echo "unsupported workload distro: ${ID} ${VERSION_ID}" >&2; exit 1 ;; | |
| 55 | +esac | |
| 56 | +case "${TARGETARCH}" in | |
| 57 | + amd64) suffix="" ;; | |
| 58 | + arm64) suffix="-aarch64" ;; | |
| 59 | + *) echo "unsupported arch: ${TARGETARCH}" >&2; exit 1 ;; | |
| 60 | +esac | |
| 61 | +release="swift-${SWIFT_VERSION}-RELEASE" | |
| 62 | +url="https://download.swift.org/swift-${SWIFT_VERSION}-release/$(echo "${platform}" | tr -d .)${suffix}/${release}/${release}-${platform}${suffix}.tar.gz" | |
| 63 | +echo "Swift toolchain: ${url}" | |
| 64 | +mkdir -p /out/usr/local/swift /out/usr/local/bin | |
| 65 | +curl -fsSL "${url}" | tar -C /out/usr/local/swift -xz --strip-components=1 | |
| 66 | +for bin in /out/usr/local/swift/usr/bin/*; do | |
| 67 | + name="$(basename "${bin}")" | |
| 68 | + [ -x "${bin}" ] || continue | |
| 69 | + ln -s "/usr/local/swift/usr/bin/${name}" "/out/usr/local/bin/${name}" | |
| 70 | +done | |
| 71 | +# In a container the Swift runtime cannot set up its crash backtracer and | |
| 72 | +# prints two warnings on every run of a Swift binary: turn it off. | |
| 73 | +mkdir -p /out/etc/profile.d | |
| 74 | +echo 'export SWIFT_BACKTRACE=enable=no' > /out/etc/profile.d/swift-backtrace.sh | |
| 75 | +EOF | |
| 76 | + | |
| 77 | +# --- overlay: only the toolchain, the links and the system packages land ----- | |
| 78 | +FROM scratch | |
| 79 | +COPY --from=build /out/ / | |
| new file mode 100644 | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | +# syntax=docker/dockerfile:1 | ||
| 2 | + | ||
| 3 | +# --- build stage: on the workload image itself ------------------------------- | ||
| 4 | +# Swift ships one toolchain per distro release, linked against that release's | ||
| 5 | +# libraries: the tarball is chosen from the workload's /etc/os-release, and the | ||
| 6 | +# system packages it needs are taken from that same release (as .deb files | ||
| 7 | +# unpacked into the overlay), so everything matches what is already installed. | ||
| 8 | +FROM docker/sandbox-templates:shell AS build | ||
| 9 | +USER root | ||
| 10 | +ARG SWIFT_VERSION | ||
| 11 | +ARG TARGETARCH | ||
| 12 | + | ||
| 13 | +# A heredoc RUN does not stop at the first failing line by itself: every | ||
| 14 | +# script starts with `set -eu`. | ||
| 15 | + | ||
| 16 | +# What the toolchain needs at run time (from swift.org's Linux dependencies): | ||
| 17 | +# the linker and C/C++ runtime headers (binutils, libc6-dev, g++ for | ||
| 18 | +# libstdc++-dev), Foundation's (libcurl, libxml2), the REPL / lldb ones | ||
| 19 | +# (libedit, libncurses, libpython3) and SwiftPM's (libsqlite3, pkg-config). | ||
| 20 | +# Packages the workload already has are not downloaded, so not overlaid. | ||
| 21 | +RUN <<EOF | ||
| 22 | +set -eu | ||
| 23 | +apt-get update | ||
| 24 | +apt-get install -y --no-install-recommends --download-only \ | ||
| 25 | + binutils libc6-dev g++ \ | ||
| 26 | + libcurl4-openssl-dev libxml2-dev zlib1g-dev \ | ||
| 27 | + libedit2 libncurses-dev libpython3-dev \ | ||
| 28 | + libsqlite3-0 pkg-config tzdata | ||
| 29 | +mkdir -p /out | ||
| 30 | +for deb in /var/cache/apt/archives/*.deb; do | ||
| 31 | + [ -e "${deb}" ] || continue | ||
| 32 | + dpkg-deb -x "${deb}" /out | ||
| 33 | +done | ||
| 34 | +# Set by update-alternatives in a real install, which unpacking skips. | ||
| 35 | +if [ -e /out/usr/bin/gcc ]; then | ||
| 36 | + ln -sf gcc /out/usr/bin/cc | ||
| 37 | +fi | ||
| 38 | +if [ -e /out/usr/bin/g++ ]; then | ||
| 39 | + ln -sf g++ /out/usr/bin/c++ | ||
| 40 | +fi | ||
| 41 | +rm -rf /out/usr/share/doc /out/usr/share/man /out/usr/share/info /out/usr/share/locale | ||
| 42 | +rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*.deb | ||
| 43 | +EOF | ||
| 44 | + | ||
| 45 | +# The toolchain, kept in one tree (/usr/local/swift) so it does not mix with | ||
| 46 | +# the workload's /usr: its binaries find their libraries and resources from | ||
| 47 | +# their real path, through the links in /usr/local/bin. | ||
| 48 | +RUN <<EOF | ||
| 49 | +set -eu | ||
| 50 | +. /etc/os-release | ||
| 51 | +case "${ID}" in | ||
| 52 | + ubuntu) platform="ubuntu${VERSION_ID}" ;; | ||
| 53 | + debian) platform="debian${VERSION_ID}" ;; | ||
| 54 | + *) echo "unsupported workload distro: ${ID} ${VERSION_ID}" >&2; exit 1 ;; | ||
| 55 | +esac | ||
| 56 | +case "${TARGETARCH}" in | ||
| 57 | + amd64) suffix="" ;; | ||
| 58 | + arm64) suffix="-aarch64" ;; | ||
| 59 | + *) echo "unsupported arch: ${TARGETARCH}" >&2; exit 1 ;; | ||
| 60 | +esac | ||
| 61 | +release="swift-${SWIFT_VERSION}-RELEASE" | ||
| 62 | +url="https://download.swift.org/swift-${SWIFT_VERSION}-release/$(echo "${platform}" | tr -d .)${suffix}/${release}/${release}-${platform}${suffix}.tar.gz" | ||
| 63 | +echo "Swift toolchain: ${url}" | ||
| 64 | +mkdir -p /out/usr/local/swift /out/usr/local/bin | ||
| 65 | +curl -fsSL "${url}" | tar -C /out/usr/local/swift -xz --strip-components=1 | ||
| 66 | +for bin in /out/usr/local/swift/usr/bin/*; do | ||
| 67 | + name="$(basename "${bin}")" | ||
| 68 | + [ -x "${bin}" ] || continue | ||
| 69 | + ln -s "/usr/local/swift/usr/bin/${name}" "/out/usr/local/bin/${name}" | ||
| 70 | +done | ||
| 71 | +# In a container the Swift runtime cannot set up its crash backtracer and | ||
| 72 | +# prints two warnings on every run of a Swift binary: turn it off. | ||
| 73 | +mkdir -p /out/etc/profile.d | ||
| 74 | +echo 'export SWIFT_BACKTRACE=enable=no' > /out/etc/profile.d/swift-backtrace.sh | ||
| 75 | +EOF | ||
| 76 | + | ||
| 77 | +# --- overlay: only the toolchain, the links and the system packages land ----- | ||
| 78 | +FROM scratch | ||
| 79 | +COPY --from=build /out/ / | ||
added
kits/swift-toolchain/swift-toolchain.yaml +33 -0 | new file mode 100644 | ||
| @@ -0,0 +1,33 @@ | ||
| 1 | +# syntax=docker/sandbox-kit:3 | |
| 2 | +schemaVersion: "3" | |
| 3 | +kind: mixin | |
| 4 | +displayName: Swift toolchain | |
| 5 | +description: Swift toolchain (swift, swiftc, Swift Package Manager, swift-format, lldb) and sourcekit-lsp (language server) | |
| 6 | + | |
| 7 | +licenses: [MIT] | |
| 8 | +version: "1.3.0" | |
| 9 | + | |
| 10 | +args: | |
| 11 | + swift_version: | |
| 12 | + # A Swift release of https://www.swift.org/install/linux/ (e.g. 6.4.2). | |
| 13 | + default: "6.4.2" | |
| 14 | + pattern: '^[0-9]+\.[0-9]+(\.[0-9]+)?$' | |
| 15 | + buildArg: SWIFT_VERSION | |
| 16 | + | |
| 17 | +provides: ["swift@${{ kit.args.swift_version }}"] | |
| 18 | + | |
| 19 | +capabilities: | |
| 20 | + # Runtime access with the tool: SwiftPM fetches packages with git, mostly | |
| 21 | + # from GitHub. Add private package hosts here (or in a kit set) if you need them. | |
| 22 | + - type: com.docker.sandbox/network-policy@1 | |
| 23 | + config: | |
| 24 | + runtime: | |
| 25 | + allow: | |
| 26 | + - github.com | |
| 27 | + - codeload.github.com | |
| 28 | + - objects.githubusercontent.com | |
| 29 | + - release-assets.githubusercontent.com | |
| 30 | + - download.swift.org | |
| 31 | + # - type: com.docker.sandbox/agent-context@1 | |
| 32 | + # config: | |
| 33 | + # contentFile: ./swift-context.md | |
| new file mode 100644 | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | +# syntax=docker/sandbox-kit:3 | ||
| 2 | +schemaVersion: "3" | ||
| 3 | +kind: mixin | ||
| 4 | +displayName: Swift toolchain | ||
| 5 | +description: Swift toolchain (swift, swiftc, Swift Package Manager, swift-format, lldb) and sourcekit-lsp (language server) | ||
| 6 | + | ||
| 7 | +licenses: [MIT] | ||
| 8 | +version: "1.3.0" | ||
| 9 | + | ||
| 10 | +args: | ||
| 11 | + swift_version: | ||
| 12 | + # A Swift release of https://www.swift.org/install/linux/ (e.g. 6.4.2). | ||
| 13 | + default: "6.4.2" | ||
| 14 | + pattern: '^[0-9]+\.[0-9]+(\.[0-9]+)?$' | ||
| 15 | + buildArg: SWIFT_VERSION | ||
| 16 | + | ||
| 17 | +provides: ["swift@${{ kit.args.swift_version }}"] | ||
| 18 | + | ||
| 19 | +capabilities: | ||
| 20 | + # Runtime access with the tool: SwiftPM fetches packages with git, mostly | ||
| 21 | + # from GitHub. Add private package hosts here (or in a kit set) if you need them. | ||
| 22 | + - type: com.docker.sandbox/network-policy@1 | ||
| 23 | + config: | ||
| 24 | + runtime: | ||
| 25 | + allow: | ||
| 26 | + - github.com | ||
| 27 | + - codeload.github.com | ||
| 28 | + - objects.githubusercontent.com | ||
| 29 | + - release-assets.githubusercontent.com | ||
| 30 | + - download.swift.org | ||
| 31 | + # - type: com.docker.sandbox/agent-context@1 | ||
| 32 | + # config: | ||
| 33 | + # contentFile: ./swift-context.md | ||
modified
release-all.sh +2 -2 | @@ -1,6 +1,6 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | : <<'COMMENT' |
| 3 | -Run every release step, 00 to 10, in order, and stop at the first failure. | |
| 3 | +Run every release step, 00 to 12, in order, and stop at the first failure. | |
| 4 | 4 | |
| 5 | 5 | 1. Update MINI_ME_VERSION, PREVIOUS_TAG, TAG and ABOUT in release.env |
| 6 | 6 | 2. Run this script: ./release-all.sh |
| @@ -18,7 +18,7 @@ FROM="${FROM:-00}" | ||
| 18 | 18 | for script in [0-9][0-9]-*.sh; do |
| 19 | 19 | step="${script%%-*}" |
| 20 | 20 | # 10# keeps "08" and "09" from being read as octal |
| 21 | - if ((10#${step} < 10#${FROM} || 10#${step} > 10)); then | |
| 21 | + if ((10#${step} < 10#${FROM} || 10#${step} > 12)); then | |
| 22 | 22 | continue |
| 23 | 23 | fi |
| 24 | 24 | |
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | : <<'COMMENT' | 2 | : <<'COMMENT' |
| 3 | -Run every release step, 00 to 10, in order, and stop at the first failure. | 3 | +Run every release step, 00 to 12, in order, and stop at the first failure. |
| 4 | 4 | ||
| 5 | 1. Update MINI_ME_VERSION, PREVIOUS_TAG, TAG and ABOUT in release.env | 5 | 1. Update MINI_ME_VERSION, PREVIOUS_TAG, TAG and ABOUT in release.env |
| 6 | 2. Run this script: ./release-all.sh | 6 | 2. Run this script: ./release-all.sh |
| @@ -18,7 +18,7 @@ FROM="${FROM:-00}" | |||
| 18 | for script in [0-9][0-9]-*.sh; do | 18 | for script in [0-9][0-9]-*.sh; do |
| 19 | step="${script%%-*}" | 19 | step="${script%%-*}" |
| 20 | # 10# keeps "08" and "09" from being read as octal | 20 | # 10# keeps "08" and "09" from being read as octal |
| 21 | - if ((10#${step} < 10#${FROM} || 10#${step} > 10)); then | 21 | + if ((10#${step} < 10#${FROM} || 10#${step} > 12)); then |
| 22 | continue | 22 | continue |
| 23 | fi | 23 | fi |
| 24 | 24 | ||
modified
release.env +3 -3 | @@ -1,8 +1,8 @@ | ||
| 1 | 1 | # ./01-release.tag.sh commit, tag, push |
| 2 | -MINI_ME_VERSION="1.0.5" | |
| 3 | -PREVIOUS_TAG="v0.1.2" | |
| 2 | +MINI_ME_VERSION="1.0.6" | |
| 3 | +PREVIOUS_TAG="v0.1.3" | |
| 4 | 4 | |
| 5 | -TAG="v0.1.3" | |
| 5 | +TAG="v0.1.4" | |
| 6 | 6 | ABOUT="Mini Me" |
| 7 | 7 | OWNER="bots-garden" |
| 8 | 8 | REPO="mini-me-kit" |
| @@ -1,8 +1,8 @@ | |||
| 1 | # ./01-release.tag.sh commit, tag, push | 1 | # ./01-release.tag.sh commit, tag, push |
| 2 | -MINI_ME_VERSION="1.0.5" | 2 | +MINI_ME_VERSION="1.0.6" |
| 3 | -PREVIOUS_TAG="v0.1.2" | 3 | +PREVIOUS_TAG="v0.1.3" |
| 4 | 4 | ||
| 5 | -TAG="v0.1.3" | 5 | +TAG="v0.1.4" |
| 6 | ABOUT="Mini Me" | 6 | ABOUT="Mini Me" |
| 7 | OWNER="bots-garden" | 7 | OWNER="bots-garden" |
| 8 | REPO="mini-me-kit" | 8 | REPO="mini-me-kit" |