-
Notifications
You must be signed in to change notification settings - Fork 29
/
docker.sh
executable file
·59 lines (49 loc) · 1.66 KB
/
docker.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Exit on error
set -e
DIR=$(pwd)
# Check settings file exists
./install/check_settings.sh
# Check if docker installed
if ! docker --version; then
# https://docs.docker.com/engine/install/debian/
sudo apt-get update -y
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose
sudo usermod -aG docker $USER
newgrp docker
fi
# Check htpasswd utility is installed
if ! command -v htpasswd &> /dev/null
then
sudo apt-get -y install apache2-utils
fi
# Source config
. config/settings.ini
# Overwrite pg_db_name variable since the dbname is the
# docker-compose service
pg_host=citizen-db
# Copy configurations
. ./install/copy_config.sh
# Generate .env file for docker-compose to have the correct
# infos about the database
echo "Generating .env file"
echo "" > .env
# Generate password
. ./install/generate_password.sh
# Prepare directories
mkdir -p media
cp -r frontend/src/assets/* media/.
# Down everything
docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
# Launch everything in detached mode
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up --build -d
# DEV : docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d