forked from revendamais/teste-dev-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·43 lines (33 loc) · 870 Bytes
/
build.sh
File metadata and controls
executable file
·43 lines (33 loc) · 870 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
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
ENV_TYPE=${ENV_TYPE:-development}
echo "Ambiente: $ENV_TYPE"
# Lista de diretórios de volume necessários
DIRS=(
"./data/${ENV_TYPE}/pg"
"./data/${ENV_TYPE}/logs/redis"
"./data/${ENV_TYPE}/logs/postgres"
"./data/${ENV_TYPE}/logs/php"
"./data/${ENV_TYPE}/logs/nginx"
"./data/${ENV_TYPE}/logs/laravel"
"./data/${ENV_TYPE}/views/laravel"
)
echo "Criando diretórios necessários para volumes..."
for dir in "${DIRS[@]}"; do
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
echo "✔️ Criado: $dir"
else
echo "↪️ Já existe: $dir"
fi
done
echo "Evitando problemas em tempo de execucao..."
docker-compose stop
if [ -n "$(docker ps -aq)" ]; then
echo "Removendo containers parados..."
docker rm $(docker ps -aq)
fi
echo "Buildando containers..."
docker-compose build
echo "Subindo ambiente..."
docker-compose up