forked from vladbabii/homeassistant-socat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-and-test.sh
executable file
·36 lines (30 loc) · 952 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
36
#!/bin/bash
clear
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
mkdir -p "$DIR/data"
TAG="octoprint-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 "octoprint-socat" | awk '{print $1}' | xargs docker stop
echo " - removing $COUNT"
docker ps -a | grep "octoprint-socat" | awk '{print $1}' | xargs docker rm
echo "... done"
fi
docker build -t "$TAG" .
docker image list | grep "$TAG"
docker run -d \
-e "SOCAT_PRINTER_HOST=10.2.1.4" \
-e "SOCAT_PRINTER_PORT=7676" \
-e "SOCAT_PRINTER_LINK=/dev/ttyACM0" \
-e "PAUSE_BETWEEN_CHECKS=10" \
-e "DEBUG_VERBOSE=1" \
-p "8000:80" \
--mount type=bind,source="$DIR/data",target=/data \
"$TAG"
docker ps -a | grep "octoprint-socat" | awk '{print $1}' | xargs -I % echo docker exec -it % /bin/bash > tmp.run.sh
bash tmp.run.sh
rm tmp.run.sh