-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·53 lines (41 loc) · 871 Bytes
/
deploy.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
#!/bin/bash
cd `dirname "$0"`
usage() {
cat 1>&2 <<EOF
Deploy an SQLite database to Solr.
Usage: $0 [OPTION]... [DATABASE]
-h, --help Show this help
EOF
exit 1
}
eval set -- `getopt --options "h" --long "help" -- "$@"`
while true; do
case "$1" in
-h|--help)
usage;;
--)
shift;
break;;
*)
usage;
esac
done
FILE=$(realpath "$1")
if [[ -z $FILE ]]; then
echo "Database file is not set." >&2
usage
fi
if [[ ! -f $FILE ]]; then
echo "Database file $FILE does not exist." >&2
exit 1
fi
echo "Deploying $FILE to Solr..."
# Path to the SQLite database file inside the container.
INTERNAL_FILE=/tmp/database.sqlite
docker compose run \
--volume "$FILE:$INTERNAL_FILE:ro" \
--build \
--rm \
cli \
bun \
deploy.ts $INTERNAL_FILE