-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtime.sh
executable file
·60 lines (52 loc) · 1.61 KB
/
runtime.sh
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
#!/bin/bash
# ---------------------------------------------------------------------------
# Build Docker image, then run Ntrip Client (runtime or interactive bash)
# ---------------------------------------------------------------------------
# Function to print usage
usage() {
echo "
Usage: dev.sh [-b|bash] [--param-file] [--use-fix-location] [--debug ] [-h|--help]
Where:
-b | bash Open bash in docker container
--param-file Path to the YAML file containing Ntrip server credentials
--use-fix-location Use fixed location for Ntrip requests
--debug Run Ntrip Client in debug mode
-h | --help Show this help message
"
exit 1
}
ENTRYPOINT=""
BASH_CMD="$@"
# Parse command-line options
while [[ "$#" -gt 0 ]]; do
case $1 in
-b|bash)
ENTRYPOINT="--entrypoint /bin/bash"
BASH_CMD=""
;;
--use-fix-location|--debug|--param-file)
# These flags are intended to be passed to
# the Docker container, so no action is needed here
;;
-h|--help)
usage
;;
*)
echo "Unknown option: $1"
usage
;;
esac
shift
done
# Create logs dir
mkdir -p scripts/logs
# Build the Docker image
docker build \
-t av_ntrip_client:latest \
-f Dockerfile --target runtime .
# Run the Docker container and pass any provided arguments
docker run -it --rm --net host --privileged \
-v /etc/localtime:/etc/localtime:ro \
-v ./scripts/logs:/workspace/scripts/logs \
$ENTRYPOINT \
av_ntrip_client:latest $BASH_CMD