-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocker.sh
More file actions
executable file
·31 lines (27 loc) · 886 Bytes
/
docker.sh
File metadata and controls
executable file
·31 lines (27 loc) · 886 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
#!/usr/bin/bash
# Define docker user and group id
DOCKER_UID=$(id -u)
DOCKER_GID=$(id -g)
USER=$(whoami)
# Import env variables from core file
# shellcheck disable=SC2046
export $(grep -v '^#' ./config/env/.core.env | xargs)
if [ "$MODE" = "test" ]; then
echo "Running tests"
# Export test env variables
# shellcheck disable=SC2046
export $(grep -v '^#' ./config/env_template/.core.env.test | xargs)
docker compose -f docker-compose.test.yml "$@"
# Check if ENV is set to development
elif [ "$ENV" = "development" ]; then
# Set the UID and GID to the current user
export DOCKER_UID=$DOCKER_UID
export DOCKER_GID=$DOCKER_GID
export USER=USER
echo "Running in development mode"
docker compose -f docker-compose.yml -f docker-compose.dev.yml "$@"
else
echo "Running in production mode"
# Run docker compose with the default arguments
docker compose "$@"
fi