-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpush-production.sh
More file actions
executable file
·28 lines (22 loc) · 1009 Bytes
/
push-production.sh
File metadata and controls
executable file
·28 lines (22 loc) · 1009 Bytes
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
#!/bin/sh -e
server=flut
port=8200
if test -z "$GITHUB_SECRET"; then
echo "No github secret set. Start with GITHUB_SECRET=<some secret>, or enter below."
#LC_ALL=C tr -dc '[:alnum:]' < /dev/urandom | head -c32 | cat
#echo ""
read -r -p 'GitHub secret to use: ' GITHUB_SECRET
fi
ssh -M -S /tmp/ssh-ctrl-socket -fnNT -L 5000:localhost:5000 $server
onkill() { ssh -S /tmp/ssh-ctrl-socket -O exit $server; }
trap onkill SIGTERM
ssh -S /tmp/ssh-ctrl-socket -O check $server || exit 1
docker login localhost:5000 || exit 1
docker build --no-cache -t docs-server --build-arg GITHUB_SECRET="$GITHUB_SECRET" .
docker tag docs-server localhost:5000/docs-server
docker push localhost:5000/docs-server
ssh -S /tmp/ssh-ctrl-socket -O exit $server
ssh $server 'sudo docker pull localhost:5000/docs-server'
ssh $server "sudo docker stop enduser-docs"
ssh $server "sudo docker rm enduser-docs"
ssh $server "sudo docker run -d --restart unless-stopped -p $port:80 --name enduser-docs localhost:5000/docs-server"