27 lines
610 B
Bash
Executable file
27 lines
610 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# examples:
|
|
# ./run-docker-compose.sh --env-file ./.env up -d
|
|
# ./run-docker-compose.sh --env-file ./.env down
|
|
|
|
# Exit on errors
|
|
set -e
|
|
|
|
# Ensure arguments are provided
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: $0 <docker compose arguments>"
|
|
exit 1
|
|
fi
|
|
|
|
# Store the user-provided arguments
|
|
ARGS="$@"
|
|
|
|
# Find all directories containing a file named docker-compose*.yml
|
|
find . -type f -name 'docker-compose*.yml' | while IFS= read -r compose_file; do
|
|
|
|
# Run the docker compose command with user arguments
|
|
echo "Running: docker compose $compose_file"
|
|
docker compose -f "$compose_file" $ARGS
|
|
|
|
done
|
|
|