forked from letsgetrusty/live-bootcamp-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker.sh
More file actions
executable file
·26 lines (22 loc) · 765 Bytes
/
docker.sh
File metadata and controls
executable file
·26 lines (22 loc) · 765 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
#!/bin/bash
# Define the location of the .env file (change if needed)
ENV_FILE="./auth-service/.env"
# Check if the .env file exists
if ! [[ -f "$ENV_FILE" ]]; then
echo "Error: .env file not found!"
exit 1
fi
## Read each line in the .env file (ignoring comments)
#while IFS= read -r line; do
# # Skip blank lines and lines starting with #
# if [[ -n "$line" ]] && [[ "$line" != \#* ]]; then
# # Split the line into key and value
# key=$(echo "$line" | cut -d '=' -f1)
# value=$(echo "$line" | cut -d '=' -f2-)
# # Export the variable
# export "$key=$value"
# fi
#done < <(grep -v '^#' "$ENV_FILE")
# Run docker-compose commands with exported variables
docker compose --env-file="$ENV_FILE" build
docker compose --env-file="$ENV_FILE" up