📚 Add 🐳 Docker Compose example for 🐘 PostgresQL

This commit is contained in:
Thomas LEVEIL
2019-08-21 21:56:23 +02:00
parent c339dfd5d6
commit 53c82c1e90
5 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
#!/bin/bash
set -e;
if [ -n "${POSTGRES_NON_ROOT_USER:-}" ] && [ -n "${POSTGRES_NON_ROOT_PASSWORD:-}" ]; then
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER ${POSTGRES_NON_ROOT_USER} WITH PASSWORD '${POSTGRES_NON_ROOT_PASSWORD}';
GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_NON_ROOT_USER};
EOSQL
else
echo "SETUP INFO: No Environment variables given!"
fi