diff --git a/docker/cameleer-postgres/Dockerfile b/docker/cameleer-postgres/Dockerfile new file mode 100644 index 0000000..85ac205 --- /dev/null +++ b/docker/cameleer-postgres/Dockerfile @@ -0,0 +1,3 @@ +FROM postgres:16-alpine +COPY init-databases.sh /docker-entrypoint-initdb.d/init-databases.sh +RUN chmod +x /docker-entrypoint-initdb.d/init-databases.sh diff --git a/docker/cameleer-postgres/init-databases.sh b/docker/cameleer-postgres/init-databases.sh new file mode 100644 index 0000000..51829de --- /dev/null +++ b/docker/cameleer-postgres/init-databases.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL + CREATE DATABASE logto; + CREATE DATABASE cameleer3; + GRANT ALL PRIVILEGES ON DATABASE logto TO $POSTGRES_USER; + GRANT ALL PRIVILEGES ON DATABASE cameleer3 TO $POSTGRES_USER; +EOSQL