Last active
April 3, 2023 10:21
-
-
Save Max95Cohen/0cfafd308fab1c2e4e32e4a69fe6b5e0 to your computer and use it in GitHub Desktop.
doker-compose bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dc() { | |
project=$1 | |
container=$2 | |
check=echo $project | grep "laravel" | |
if [ -z $check ]; then | |
path="frontend" | |
if [ -z $container ]; then | |
container="phalcon" | |
path="api" | |
fi | |
if [ ! -z $1 ] && [ $1 != "dev" ]; then | |
project=echo $1 | tr '[:lower:]' '[:upper:]' | |
fi | |
else | |
container="laravel" | |
path="frontend" | |
project="" | |
fi | |
path_=$path | |
if [ -z $project ]; then | |
path=~/$path | |
else | |
if [ $1 == 'dev' ]; then | |
path="/var/www/$path" | |
else | |
path="/var/www/builds/$path/$project" | |
fi | |
fi | |
cd $path | |
if [ ! -z $project ]; then | |
project="-p ${project}_$path_" | |
fi | |
docker-compose $project exec $container bash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment