10 lines
762 B
Bash
Executable File
10 lines
762 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
root="${CARD_ROOT:?CARD_ROOT required}"; work="$(mktemp -d)"; trap 'rm -rf -- "$work"' EXIT
|
|
mkdir "$work/context"; printf 'hello from image\n' >"$work/context/hello.txt"
|
|
printf 'FROM scratch\nLABEL lesson="console"\nCOPY hello.txt /hello.txt\nCMD ["cat", "/hello.txt"]\n' >"$work/context/Dockerfile"
|
|
result="$(python3 "$root/src/fixtures/container_lab.py" "$work/state.json" build lesson:v1 "$work/context")"
|
|
digest="${result%% *}"; [[ "$digest" =~ ^sha256:[0-9a-f]{64}$ && "$result" == *'instructions=4' ]]
|
|
python3 "$root/src/fixtures/container_lab.py" "$work/state.json" image-inspect lesson:v1 | grep -q '"CMD"'
|
|
printf 'PASS task01 syntax=valid instructions=4 digest=%s engine=offline-model socket_exposed=0\n' "$digest"
|