docker-postgres/initScript/init.sh

16 lines
477 B
Bash

#!/bin/bash
set -e
app_password="$POSTGRES_APP_PASSWORD"
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER docker WITH PASSWORD '$app_password';
CREATE DATABASE docker;
GRANT ALL PRIVILEGES ON DATABASE docker TO docker;
-- SELECT datname FROM pg_database WHERE datistemplate = false;
-- SELECT table_schema,table_name
-- FROM information_schema.tables
-- ORDER BY table_schema,table_name;
EOSQL