-
-
Save ragboyjr/2d5d77e21ebc8d920ff8224575b1e4ba to your computer and use it in GitHub Desktop.
Docker Compose alias for powerful configuration
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
#!/usr/bin/env bash | |
[ -z "$DC_EXECUTABLE" ] && DC_EXECUTABLE=docker-compose | |
[ -z "$DC_PATH" ] && DC_PATH=.:./dev/bin:./dev/docker/bin | |
for p in $(echo ${DC_PATH} | tr ":" " "); do | |
if [ -x "${p}/${DC_EXECUTABLE}" ]; then | |
${p}/${DC_EXECUTABLE} "$@" | |
exit $? | |
fi | |
done | |
docker-compose "$@" |
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
#!/usr/bin/env bash | |
# this file exists in your repo as an executable. You could run this as ./docker-compose {args} | |
up() { | |
# run any pre up scripts | |
docker-compose up -d "$@" | |
# run any post up scripts | |
} | |
if [[ $1 =~ ^(up)$ ]]; then | |
$1 "${@:2}" | |
else | |
docker-compose "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Like most programmers, you have 80% of the job done and just walk away. In order to install dc:
curl -o /usr/local/bin/dc https://gist.githubusercontent.com/ragboyjr/2d5d77e21ebc8d920ff8224575b1e4ba/raw/0b8352dbb2ab172739b73791a9724d2b6a0ffd99/dc && chmod +x /usr/local/bin/dc