Sign inSign up

todddensmore978/docker-instruqt-kit:2.0.0

Multi-platform
Manifest digest

sha256:8f9d3400dea9b641d5ce969ba05ccef9376a4d0da99dad192db63ac11fc72df2

Last pushed

5 days by todddensmore978

Type

Sandbox Kit

Manifest digest

sha256:8f9d3400dea9b641d5ce969ba05ccef9376a4d0da99dad192db63ac11fc72df2

yaml
schemaVersion: "3"
displayName: Docker Instruqt lab standard
author: Docker Professional Services
description: Makes every Instruqt track the agent writes look and behave like a professional Docker lab. Stages the lab-style, lab-track, lab-scripts, lab-brief, lab-create, lab-add-challenge, and lab-review skills, the labkit command (scaffold, lint, preview), and the Docker lab theme. No Instruqt credential enters the sandbox.
version: 2.0.0
licenses:
    - Apache-2.0
kind: mixin
provides:
    - docker-instruqt
capabilities:
    - type: com.docker.sandbox/network-policy@1
      config:
        install:
            allow:
                - archive.ubuntu.com
                - security.ubuntu.com
                - ports.ubuntu.com
                - pypi.org
                - files.pythonhosted.org
                - cdn.playwright.dev
                - playwright.download.prss.microsoft.com
                - github.com
                - objects.githubusercontent.com
                - release-assets.githubusercontent.com
        runtime:
            allow:
                - docs.instruqt.com
                - docs.docker.com
                - fonts.googleapis.com
                - fonts.gstatic.com
    - type: com.docker.sandbox/agent-context@1
      config:
        contentFile: /usr/share/sandbox/kit/docker-instruqt/docker-instruqt-context.md
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                set -eu
                export DEBIAN_FRONTEND=noninteractive
                apt-get update -qq
                apt-get install -y -qq --no-install-recommends shellcheck unzip curl ca-certificates fonts-inter fonts-roboto
                rm -rf /var/lib/apt/lists/*
              description: Install shellcheck and fonts
              user: "0"
            - command: |
                set -eu
                pip3 install --quiet --break-system-packages -r /home/agent/labkit/requirements.txt
                chmod +x /home/agent/.local/bin/labkit
                chown -R agent:agent /home/agent/labkit /home/agent/.local /home/agent/brand 2>/dev/null || true
              description: Install labkit's Python dependencies
              user: "0"
            - command: |
                set -eu
                # The instruqt CLI ships a Linux build for x86 only. Pinned, checksum verified.
                if [ "$(uname -m)" != "x86_64" ]; then
                  echo "instruqt CLI skipped: no Linux build for $(uname -m). labkit validate will say so."
                  exit 0
                fi
                v=2427-422d0f4
                sha=6bcef7c37b82fce83653c620d1eb1d11577e0d5b962fcc34ebb4358e61220735
                tmp=$(mktemp -d)
                curl -fsSL "https://github.com/instruqt/cli/releases/download/$v/instruqt-linux.zip" -o "$tmp/i.zip"
                echo "$sha  $tmp/i.zip" | sha256sum -c -
                unzip -q "$tmp/i.zip" -d "$tmp"
                install -m 0755 "$tmp/instruqt" /usr/local/bin/instruqt
                rm -rf "$tmp"
                instruqt version | head -2
              description: Install the instruqt CLI when the architecture allows
              user: "0"
            - command: |
                set -u
                # Optional: headless Chromium so labkit preview can write PNGs. Failure is not fatal.
                # Playwright's --with-deps refuses newer Ubuntu releases, so install the libraries with apt
                # and download the Ubuntu 24.04 build, which runs on later releases.
                export DEBIAN_FRONTEND=noninteractive PLAYWRIGHT_BROWSERS_PATH=/opt/pw
                case "$(uname -m)" in x86_64) plat=ubuntu24.04-x64 ;; *) plat=ubuntu24.04-arm64 ;; esac
                apt-get update -qq || true
                apt-get install -y -qq --no-install-recommends libglib2.0-0t64 libdbus-1-3 libatk1.0-0t64 libatspi2.0-0t64 \
                  libx11-6 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxcb1 libxkbcommon0 \
                  libasound2t64 libnss3 libnspr4 libcups2t64 libdrm2 libpango-1.0-0 libcairo2 || true
                rm -rf /var/lib/apt/lists/*
                if pip3 install --quiet --break-system-packages "playwright==1.55.0" \
                  && PLAYWRIGHT_HOST_PLATFORM_OVERRIDE="$plat" python3 -m playwright install chromium; then
                  chmod -R a+rX /opt/pw
                  echo "chromium installed"
                else
                  echo "preview PNGs unavailable: Chromium did not install. HTML preview still works." >&2
                fi
                exit 0
              description: Install headless Chromium for preview screenshots (optional)
              user: "0"
            - command: |
                set -eu
                su agent -c '/home/agent/.local/bin/labkit rules >/dev/null && /home/agent/.local/bin/labkit --version'
                command -v shellcheck >/dev/null
                echo "docker-instruqt kit ready"
              description: Verify the toolchain
              user: "0"