mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-26 20:54:08 +00:00
* chore: add development Docker image skill Signed-off-by: WenyXu <wenymedia@gmail.com> * fix: harden development image skill Signed-off-by: WenyXu <wenymedia@gmail.com> * fix: address development image review feedback Signed-off-by: WenyXu <wenymedia@gmail.com> * fix: add image tag script license header Signed-off-by: WenyXu <wenymedia@gmail.com> --------- Signed-off-by: WenyXu <wenymedia@gmail.com>
66 lines
1.5 KiB
Bash
Executable File
66 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
printf 'Usage: %s --source PATH --bin NAME --profile PROFILE [--target RUST_TARGET] [--package PACKAGE] [--features FEATURES]\n' "$0" >&2
|
|
}
|
|
|
|
source_dir=""
|
|
binary_name=""
|
|
profile=""
|
|
target=""
|
|
package=""
|
|
features=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--source|--bin|--profile|--target|--package|--features)
|
|
if [[ $# -lt 2 ]]; then
|
|
usage
|
|
exit 2
|
|
fi
|
|
case "$1" in
|
|
--source) source_dir="$2" ;;
|
|
--bin) binary_name="$2" ;;
|
|
--profile) profile="$2" ;;
|
|
--target) target="$2" ;;
|
|
--package) package="$2" ;;
|
|
--features) features="$2" ;;
|
|
esac
|
|
shift 2
|
|
;;
|
|
*)
|
|
usage
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ -z "$source_dir" || -z "$binary_name" || -z "$profile" ]]; then
|
|
usage
|
|
exit 2
|
|
fi
|
|
|
|
if [[ ! -f "$source_dir/Cargo.toml" ]]; then
|
|
printf 'error: not a Cargo workspace: %s\n' "$source_dir" >&2
|
|
exit 1
|
|
fi
|
|
|
|
command=(cargo build --locked --bin "$binary_name" --profile "$profile")
|
|
if [[ -n "$package" ]]; then
|
|
command+=(--package "$package")
|
|
fi
|
|
if [[ -n "$features" ]]; then
|
|
command+=(--features "$features")
|
|
fi
|
|
if [[ -n "$target" ]]; then
|
|
command+=(--target "$target")
|
|
fi
|
|
|
|
printf 'building %s with profile %s\n' "$binary_name" "$profile"
|
|
(
|
|
cd "$source_dir"
|
|
exec "${command[@]}"
|
|
)
|