This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
concourse-buildkit/entrypoint.sh

48 lines
741 B
Bash
Raw Normal View History

2022-03-09 13:40:17 +01:00
#!/usr/bin/env sh
2022-03-09 16:02:03 +01:00
fail() {
echo "Error:" "$@" 1>&2
exit 1
}
2022-03-09 16:09:23 +01:00
echo_and_run() {
echo "$@"
"$@"
}
2022-03-09 16:02:03 +01:00
plain() {
buildctl-daemonless.sh "$@"
}
build() {
if [ -z "$dest" ]; then
fail "missing argument: dest"
2022-03-09 16:02:03 +01:00
fi
if [ -z "$context" ]; then
context=.
fi
if [ -z "$platform" ]; then
platform=""
else
platform="--opt platform=$platform"
fi
2022-03-09 16:09:23 +01:00
echo_and_run buildctl-daemonless.sh \
2022-03-09 16:02:03 +01:00
build \
--frontend dockerfile.v0 \
--local context="$context" \
--local dockerfile="$context" \
$platform \
2022-08-29 18:15:09 +02:00
--output type=oci,dest="$dest"
2022-03-09 16:02:03 +01:00
}
if [ -z "$manual" ]; then
manual=false
fi
if "$manual"; then
plain "$@"
else
build
fi