Skip to content

Commit 13d4776

Browse files
committed
Using the standard postgres image and added docker-compose
1 parent a24d49c commit 13d4776

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pg-db-data

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# FROM postgres:12
2-
FROM bitnami/postgresql
1+
FROM postgres:12
2+
# FROM bitnami/postgresql
33
COPY create-multiple-postgresql-databases.sh /docker-entrypoint-initdb.d/

create-multiple-postgresql-databases.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ set -u
66
function create_user_and_database() {
77
local database=$1
88
echo " Creating user and database '$database'"
9-
psql -v ON_ERROR_STOP=1 --username "$POSTGRESQL_USERNAME" <<-EOSQL
9+
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
1010
CREATE DATABASE $database;
11-
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRESQL_USERNAME;
11+
GRANT ALL PRIVILEGES ON DATABASE $database TO $POSTGRES_USER;
1212
EOSQL
1313
}
1414

docker-compose.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: '3'
2+
3+
volumes:
4+
postgres:
5+
6+
services:
7+
postgresql:
8+
restart: always
9+
image: irobbierobinson/multi-postgres:latest
10+
volumes:
11+
- ./pg-db-data:/bitnami/postgresql
12+
environment:
13+
- POSTGRES_PASSWORD=postgres
14+
- POSTGRES_USER=postgres
15+
- POSTGRES_DB=postgres
16+
- POSTGRES_MULTIPLE_DATABASES=keycloak,bpm
17+
ports:
18+
- 5432:5432
19+
networks:
20+
- backend
21+
networks:
22+
backend:
23+
driver: bridge
24+

0 commit comments

Comments
 (0)