-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.bash
More file actions
executable file
·60 lines (50 loc) · 1.47 KB
/
Copy pathbuild.bash
File metadata and controls
executable file
·60 lines (50 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
set -euo pipefail
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_IMAGE="${BASE_IMAGE:-kumarrobotics/dcist-master-jazzy-nvda:latest}"
IMAGE_REPOSITORY="${JACKAL_AUTONOMY_REPOSITORY:-kumarrobotics/jackal_autonomy}"
IMAGE="${JACKAL_AUTONOMY_IMAGE:-${IMAGE_REPOSITORY}:${JACKAL_AUTONOMY_TAG:-latest}}"
usage() {
echo "Usage: $0 [-t|--tag TAG]"
}
while [ "$#" -gt 0 ]; do
case "$1" in
-t|--tag)
if [ "$#" -lt 2 ] || [ -z "$2" ]; then
echo "ERROR: $1 requires a tag."
usage
exit 2
fi
IMAGE="${IMAGE_REPOSITORY}:$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "ERROR: Unknown argument: $1"
usage
exit 2
;;
esac
done
if [ "$(id -u)" -ne 1000 ]; then
echo "ERROR: This script must be run by the UID-1000 host user."
echo " Current UID: $(id -u), current GID: $(id -g)"
exit 1
fi
if ! docker image inspect "$BASE_IMAGE" >/dev/null 2>&1; then
echo "ERROR: Required base image is not available locally: $BASE_IMAGE"
echo "This script will not rebuild or substitute for the base image."
exit 2
fi
echo -e "\033[0;35mBUILDING JACKAL AUTONOMY IMAGE\033[0m"
echo -e "\033[0;35mBASE IMAGE: \033[0m$BASE_IMAGE"
echo -e "\033[0;35mOUTPUT IMAGE: \033[0m$IMAGE"
docker build \
--build-arg "BASE_IMAGE=$BASE_IMAGE" \
--file "$PROJECT_DIR/Dockerfile" \
--tag "$IMAGE" \
"$PROJECT_DIR"
echo -e "\033[0;35mBUILT: \033[0m$IMAGE"