Skip to content

Instantly share code, notes, and snippets.

@jdaarevalo
Created January 30, 2021 12:05
Show Gist options
  • Save jdaarevalo/74f09af23551e73c20363cb697df8a92 to your computer and use it in GitHub Desktop.
Save jdaarevalo/74f09af23551e73c20363cb697df8a92 to your computer and use it in GitHub Desktop.
section-of-postgres-docker-entrypoint
....
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh)
if [ -x "$f" ]; then
echo "$0: running $f"
"$f"
else
echo "$0: sourcing $f"
. "$f"
fi
;;
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
*) echo "$0: ignoring $f" ;;
esac
echo
done
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment