Moved image building from docker-compose to startup script.
This commit is contained in:
parent
e850b73902
commit
e4ca53ae54
@ -4,7 +4,7 @@ services:
|
||||
|
||||
openvpn-server:
|
||||
image: openvpn-server:$VERSION_OPENVPN_SERVER
|
||||
build: "https://git.scimetis.net/yohan/docker-OpenVPN-server.git"
|
||||
#build: "https://git.scimetis.net/yohan/docker-OpenVPN-server.git"
|
||||
ports:
|
||||
- 1194:1194/udp
|
||||
volumes:
|
||||
|
22
down.sh
Executable file
22
down.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo docker-compose kill -s SIGTERM
|
||||
COUNT=1
|
||||
ATTEMPT=0
|
||||
|
||||
while [ $COUNT -ne 0 ] && [ $ATTEMPT -lt 10 ]
|
||||
do
|
||||
sleep 1
|
||||
COUNT=$(sudo docker-compose top | wc -l)
|
||||
ATTEMPT=$(( $ATTEMPT + 1 ))
|
||||
done
|
||||
|
||||
if [ $COUNT -eq 0 ]
|
||||
then
|
||||
sudo docker-compose down
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: Some containers are still running"
|
||||
sudo docker-compose ps
|
||||
exit 1
|
||||
fi
|
@ -19,6 +19,12 @@ sudo chown -R root. conf server.conf
|
||||
|
||||
# --force-recreate is used to recreate container when crontab file has changed
|
||||
unset VERSION_OPENVPN_SERVER
|
||||
VERSION_OPENVPN_SERVER=$(git ls-remote https://${GIT_SERVER}/yohan/docker-OpenVPN-server.git| head -1 | cut -f 1|cut -c -10) \
|
||||
export VERSION_OPENVPN_SERVER=$(git ls-remote https://${GIT_SERVER}/yohan/docker-OpenVPN-server.git| head -1 | cut -f 1|cut -c -10)
|
||||
|
||||
mkdir -p ~/build
|
||||
git clone https://git.scimetis.net/yohan/docker-OpenVPN-server.git ~/build/docker-OpenVPN-server
|
||||
sudo docker build -t openvpn-server:$VERSION_OPENVPN_SERVER ~/build/docker-OpenVPN-server
|
||||
|
||||
sudo -E bash -c 'docker-compose up -d --force-recreate'
|
||||
|
||||
rm -rf ~/build
|
||||
|
Loading…
Reference in New Issue
Block a user