forked from starkdg/Redis-ImageScout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_run_redis
executable file
·30 lines (26 loc) · 1.1 KB
/
docker_run_redis
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
#!/bin/bash
function main() {
SCRIPT_DIR=$(getSource)
cd "$SCRIPT_DIR" || return
REDIS_MOUNT="${HOME}"/DATA/redis/6383
docker build --tag luxcium-imgscout:0.1.1 . || return 33
(
(docker container rm imgscout) >/dev/null ||
(docker container stop imgscout) >/dev/null &&
(docker container rm imgscout) >/dev/null
) 2>/dev/null
docker run --detach --rm --publish 6383:6383 --volume "${REDIS_MOUNT}":/data --name imgscout luxcium-imgscout:0.1.1 || return 55
}
# docker run -it --entrypoint /bin/bash --rm --publish 6383:6383 --volume "${REDIS_MOUNT}":/data --name imgscout luxcium-imgscout:0.1.2
function getSource() {
SOURCE=${BASH_SOURCE[0]}
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd)
}
main
unset -f main
unset -f getSource