Created
May 3, 2021 17:03
-
-
Save vknabel/c7349bfac9be10b81b4fb8b9e931c497 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
function psqlhere() { | |
local CURRENT_BASENAME=$(basename "$PWD") | |
echo -e "\e[1;32mDATABASE_URL postgres://$CURRENT_BASENAME:$CURRENT_BASENAME@localhost/$CURRENT_BASENAME\e[0m"; | |
docker run --rm \ | |
--env POSTGRES_USER=$CURRENT_BASENAME \ | |
--env POSTGRES_DB=$CURRENT_BASENAME \ | |
--env POSTGRES_PASSWORD=$CURRENT_BASENAME \ | |
--publish 5432:5432 \ | |
--name "psql-$CURRENT_BASENAME" \ | |
--tty --interactive \ | |
--volume "/Users/vknabel/dev/psqlhere/$PWD":/var/lib/postgresql/data \ | |
postgres:11-alpine | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment