Created
May 13, 2024 01:10
-
-
Save distrill/d7134d90ccdbc6cdcda1e3622a316223 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
file="./container/docker-compose.yml" | |
project="whatever" | |
case $1 in | |
"up") | |
echo "setting up containers in background" | |
docker-compose -f $file -p $project up -d | |
;; | |
"down") | |
echo "tearing down all containers for this project" | |
docker-compose -f $file -p $project down -v | |
docker stop $(docker ps -a | grep mx | awk '{print $1}') 2> /dev/null | |
docker rm $(docker ps -a | grep mx | awk '{print $1}') 2> /dev/null | |
;; | |
"build") | |
echo "(re) building containers" | |
docker-compose -f $file -p $project build app | |
;; | |
"app") | |
echo "running shell for app" | |
docker-compose -f $file -p $project exec app /bin/bash | |
;; | |
"db") | |
echo "opening db shell for db" | |
# docker-compose -f $file -p $project exec db /bin/bash | |
docker-compose -f $file -p $project exec db psql -U db | |
;; | |
*) | |
echo "unsupported or missing argument: $1" | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment