-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
17 lines (16 loc) · 708 Bytes
/
deploy.sh
File metadata and controls
17 lines (16 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
docker build -t kostyaurysov/sample-node .
docker push kostyaurysov/sample-node
ssh -i deploy deploy@35.187.30.81 << EOF
docker pull kostyaurysov/sample-node:latest
# stop and remove a container
# '|| true' - allows us to ignore any error during the execution of command and proceed
docker stop web || true
docker rm web || true
# remove all images
docker rmi kostyaurysov/sample-node:current || true
# change tag of a container from latest to current
docker tag kostyaurysov/sample-node:latest kostyaurysov/sample-node:current
# run a container with expost 80 port, which will restart in case of any error
docker run -d --restart always --name web -p 80:80 kostyaurysov/sample-node:current
EOF