]> git.somenet.org - pub/jan/aic18.git/blob - provision.sh
Add Dockerfile for website service
[pub/jan/aic18.git] / provision.sh
1 #!/bin/bash
2
3 cd /vagrant
4
5 ###############################
6 # Get Docker + Docker-Compose #
7 ###############################
8 # Check for updates only once per boot.
9 dpkg-query -W docker-ce docker-compose &>/dev/null || rm -f /tmp/apt_run_this_boot
10
11 if [ ! -f /tmp/apt_run_this_boot ]; then
12     apt-get update
13     apt-get install -y -q apt-transport-https vim
14
15     wget -q "https://download.docker.com/linux/debian/gpg" -O - | apt-key add
16     echo "deb https://download.docker.com/linux/debian stretch stable" > /etc/apt/sources.list.d/docker_com.list
17
18     apt-get update
19     apt-get install -y -q docker-ce docker-compose
20
21     date -Isec > /tmp/apt_run_this_boot
22 fi
23
24 #############################
25 # remove running containers #
26 #############################
27 docker rm -f $(docker ps -aq) 2>/dev/null
28
29 ###################
30 # (re)compose all #
31 ###################
32 docker-compose -f g6t4 up --build -d
33
34 ###########
35 # cleanup #
36 ###########
37 docker system prune --volumes -f