-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1855e9
commit f6b3c7d
Showing
13 changed files
with
119 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.DS_Store | ||
/.idea | ||
*/cache/* | ||
cache | ||
buildctl.trace.json | ||
cache/ | ||
/xxx-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,61 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
# shellcheck source=/dev/null | ||
root="$(cd "$(dirname "${BASH_SOURCE[0]:-$PWD}")" 2>/dev/null 1>&2 && pwd)/../" | ||
readonly root | ||
|
||
PATH="$(pwd)/cache/bin:$PATH" | ||
export PATH | ||
# shellcheck source=/dev/null | ||
BIN_LOCATION="${BIN_LOCATION:-$root/cache/bin}" . "$root/hack/helpers/install-tools.sh" | ||
|
||
"./hack/helpers/install-tools.sh" "./cache/bin" | ||
rm -f "$root/cache/buildctl.trace.json" | ||
|
||
rm -f "./buildctl.trace.json" | ||
# Build the cue invocation | ||
params=(cue) | ||
case "${1:-}" in | ||
# Provisional | ||
"--version") | ||
exit | ||
;; | ||
# Provisional | ||
"--help") | ||
exit | ||
;; | ||
*) | ||
cd "$root" | ||
target=image | ||
files=("$root/hack/recipe.cue" "$root/hack/helpers/cue_tool.cue") | ||
isparam= | ||
for i in "$@"; do | ||
if [ "${i:0:2}" == "--" ]; then | ||
params+=("$i") | ||
isparam=true | ||
elif [ "$isparam" == true ]; then | ||
params+=("$i") | ||
isparam= | ||
elif [ "${i##*.}" == "cue" ]; then | ||
files+=("$i") | ||
else | ||
target="$i" | ||
fi | ||
done | ||
com=("${params[@]}") | ||
com+=("$target") | ||
com+=("${files[@]}") | ||
|
||
com=(cue) | ||
files=("./hack/recipe.cue" "./hack/helpers/cue_tool.cue") | ||
isflagvalue= | ||
for i in "$@"; do | ||
if [ "${i:0:2}" == "--" ]; then | ||
com+=("$i") | ||
isflagvalue=true | ||
elif [ "$isflagvalue" == true ]; then | ||
com+=("$i") | ||
isflagvalue= | ||
elif [ "${i##*.}" == "cue" ]; then | ||
files+=("$i") | ||
else | ||
target="$i" | ||
fi | ||
done | ||
com+=("${target:-image}") | ||
com+=("${files[@]}") | ||
|
||
echo "------------------------------------------------------------------" | ||
for i in "${com[@]}"; do | ||
if [ "${i:0:2}" == -- ]; then | ||
>&2 printf " %s" "$i" | ||
else | ||
>&2 printf " %s\n" "$i" | ||
fi | ||
done | ||
echo "------------------------------------------------------------------" | ||
"${com[@]}" || { | ||
cd - > /dev/null | ||
>&2 printf "Execution failure" | ||
exit 1 | ||
} | ||
cd - > /dev/null | ||
echo "------------------------------------------------------------------" | ||
for i in "${com[@]}"; do | ||
if [ "${i:0:2}" == -- ]; then | ||
>&2 printf " %s" "$i" | ||
else | ||
>&2 printf " %s\n" "$i" | ||
fi | ||
done | ||
"${com[@]}" || { | ||
cd - > /dev/null | ||
echo "Execution failure" | ||
exit 1 | ||
} | ||
cd - > /dev/null | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit -o errtrace -o functrace -o nounset -o pipefail | ||
|
||
readonly SUITE=bullseye | ||
readonly DATE=2023-01-01 | ||
readonly IMAGE_BLDKT="${IMAGE_BLDKT:-docker.io/dubodubonduponey/buildkit:$SUITE-$DATE}" | ||
export TAG=latest | ||
readonly IMAGE_BLDKT="${IMAGE_BLDKT:-docker.io/dubodubonduponey/buildkit:$TAG}" | ||
|
||
setup::buildkit() { | ||
[ "$(docker container inspect -f '{{.State.Running}}' dbdbdp-buildkit 2>/dev/null)" == "true" ] || { | ||
docker run --pull always --rm -d \ | ||
-p 4242:4242 \ | ||
--network host \ | ||
--name dbdbdp-buildkit \ | ||
--env MDNS_ENABLED=true \ | ||
--env MDNS_HOST=buildkit-machina \ | ||
--env MDNS_NAME="Dubo Buildkit on la machina" \ | ||
--env MOD_MDNS_ENABLED=true \ | ||
--env MOD_MDNS_HOST=buildkit-machina \ | ||
--env MOD_MDNS_NAME="Dubo Buildkit on la machina" \ | ||
--entrypoint buildkitd \ | ||
--user root \ | ||
--privileged \ | ||
"$IMAGE_BLDKT" | ||
docker exec --env QEMU_BINARY_PATH=/boot/bin/ dbdbdp-buildkit binfmt --install all | ||
docker exec dbdbdp-buildkit mkdir /tmp/runtime | ||
} | ||
} | ||
|
||
setup::buildkit 1>&2 || { | ||
printf >&2 "Something wrong with starting buildkit\n" | ||
echo >&2 "Something wrong with starting buildkit" | ||
exit 1 | ||
} | ||
|
||
printf "docker-container://dbdbdp-buildkit\n" | ||
echo "docker-container://dbdbdp-buildkit" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.