Skip to content

Commit 54587e9

Browse files
committed
Add Dockerfile and custom image build instructions
1 parent 27726d8 commit 54587e9

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Dockerfile

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

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ mechanism.
1515

1616
## Usage
1717

18+
### By mounting a volume
19+
1820
Clone the repository, mount its directory as a volume into
1921
`/docker-entrypoint-initdb.d` and declare database names separated by commas in
2022
`POSTGRES_MULTIPLE_DATABASES` environment variable as follows
@@ -28,3 +30,21 @@ Clone the repository, mount its directory as a volume into
2830
- POSTGRES_MULTIPLE_DATABASES=db1,db2
2931
- POSTGRES_USER=myapp
3032
- POSTGRES_PASSWORD=
33+
34+
### By building a custom image
35+
36+
Clone the repository, build and push the image to your Docker repository,
37+
for example for Google Private Repository do the following:
38+
39+
docker build --tag=eu.gcr.io/your-project/postgres-multi-db
40+
gcloud docker -- push eu.gcr.io/your-project/postgres-multi-db
41+
42+
You still need to pass the `POSTGRES_MULTIPLE_DATABASES` environment variable
43+
to the container:
44+
45+
myapp-postgresql:
46+
image: eu.gcr.io/your-project/postgres-multi-db
47+
environment:
48+
- POSTGRES_MULTIPLE_DATABASES=db1,db2
49+
- POSTGRES_USER=myapp
50+
- POSTGRES_PASSWORD=

0 commit comments

Comments
 (0)