-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart-stop.sh
More file actions
executable file
·37 lines (29 loc) · 1.01 KB
/
start-stop.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1.01 KB
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
#!/bin/bash
# Exit immediately if a command exits with a non-zero status.
set -e
# Default environment file
ENV_FILE="production.env"
COMPOSE_FILE="docker-compose.test.yml"
PUSH=true
START=true
# Read script parameters:
# --test or --prod determines env file we will use
# --stop stops and skips start
while [[ "$#" -gt 0 ]]; do
case $1 in
--test) ENV_FILE="test.env"; COMPOSE_FILE="docker-compose.test.yml"; shift ;;
--prod) ENV_FILE="production.env"; COMPOSE_FILE="docker-compose.prod.gcp.yml"; shift ;;
--stop) START=false; shift ;;
--help) echo "Usage: $0 [--test | --prod] [--stop]"; exit 0 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
done
# Some logging
echo "Using environment file: $ENV_FILE"
echo "Using docker compose file: $COMPOSE_FILE"
docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" down
if [ "$START" = true ]; then
docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" up --build -d
else
echo "Skipping start of the containers."
fi