Skip to content

Commit 4c55d63

Browse files
committed
tools: add docker-run script for SDK container execution
The script executes build scripts within the Bottlerocket SDK container by reading configuration from Twoliter.lock and optional overrides from Twoliter.override. It mounts the current directory and preserves user permissions to ensure proper file ownership of generated artifacts. Signed-off-by: Jingwei Wang <jweiw@amazon.com>
1 parent 95e6b9f commit 4c55d63

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tools/docker-run.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
set -e -o pipefail
3+
4+
5+
bail() {
6+
if [[ $# -gt 0 ]]; then
7+
>&2 echo "Error: $*"
8+
fi
9+
exit 1
10+
}
11+
12+
SCRIPT_PATH="$1"
13+
14+
source="$(tq -r ".sdk.source" -f Twoliter.lock)"
15+
version="$(tq -r ".sdk.version" -f Twoliter.lock)"
16+
_name="$(tq -r ".sdk.name" -f Twoliter.lock)"
17+
_registry="${source%/*}"
18+
19+
registry="$(tq -r ".bottlerocket.bottlerocket-sdk.registry" -f Twoliter.override 2>/dev/null || echo "$_registry")"
20+
name="$(tq -r ".bottlerocket.bottlerocket-sdk.name" -f Twoliter.override 2>/dev/null || echo "$_name")"
21+
22+
SDK="${registry}/${name}:v${version}"
23+
24+
docker run --rm \
25+
-v "$(pwd):/bottlerocket-kernel-kit" \
26+
--user "$(id -u):$(id -g)" \
27+
"${SDK}" \
28+
bash "${SCRIPT_PATH}"
29+

0 commit comments

Comments
 (0)