-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild-and-test.sh
35 lines (29 loc) · 943 Bytes
/
build-and-test.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
#!/bin/bash
clear
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
mkdir -p "$DIR/config"
TAG="homeassistant-socat:latest"
COUNT=$( docker ps -a | grep "$TAG" | wc -l )
if [ "$COUNT" == "0" ] ; then
echo "all clear"
else
echo "clearing..."
echo " - stopping $COUNT"
docker ps -a | grep "homeassistant-socat" | awk '{print $1}' | xargs docker stop
echo " - removing $COUNT"
docker ps -a | grep "homeassistant-socat" | awk '{print $1}' | xargs docker rm
echo "... done"
fi
docker build -t "$TAG" .
docker image list | grep "$TAG"
docker run -d \
-e "SOCAT_ZWAVE_HOST=127.0.0.1" \
-e "SOCAT_ZWAVE_PORT=7676" \
-e "SOCAT_ZWAVE_LINK=/dev/zwave" \
-e "PAUSE_BETWEEN_CHECKS=10" \
-p "9123:8123" \
--mount type=bind,source="$DIR/config",target=/config \
"$TAG"
docker ps -a | grep "homeassistant-socat" | awk '{print $1}' | xargs -I % echo docker exec -it % /bin/bash > tmp.run.sh
bash tmp.run.sh
rm tmp.run.sh