-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·37 lines (28 loc) · 902 Bytes
/
build.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
#!/bin/bash
#
# This script downloads the current docker container
# and starts it with autorestart.
# I use this script on a raspberry pi running ubuntu
#
INVERTER_PASSWORD="MyPassword"
if [[ $EUID -eq 0 ]]; then
echo "This script must NOT run as root"
exit 1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${DIR}
programname=sma2mqtt
docker stop $programname
docker container rm $programname
version="jollyjinx/$programname:latest"
#version="jollyjinx/$programname:development"
DOCKER_UID=$(id -u ${USER})
DOCKER_GID=$(id -g ${USER})
docker run \
--detach --restart=always \
-u $DOCKER_UID:$DOCKER_GID \
--net service16 \
--log-opt max-size=1m --log-opt max-file=2 \
--name "$programname" \
"$version" "$programname" --inverter-password "$INVERTER_PASSWORD"
#docker network connect mqtt-net "$programname"