Add Dockerfile and custom image build instructions
This commit is contained in:
		
							parent
							
								
									27726d807d
								
							
						
					
					
						commit
						54587e9963
					
				
							
								
								
									
										2
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | FROM postgres:9.6 | ||||||
|  | COPY create-multiple-postgresql-databases.sh /docker-entrypoint-initdb.d/ | ||||||
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							| @ -15,6 +15,8 @@ mechanism. | |||||||
| 
 | 
 | ||||||
| ## Usage | ## Usage | ||||||
| 
 | 
 | ||||||
|  | ### By mounting a volume | ||||||
|  | 
 | ||||||
| Clone the repository, mount its directory as a volume into | Clone the repository, mount its directory as a volume into | ||||||
| `/docker-entrypoint-initdb.d` and declare database names separated by commas in | `/docker-entrypoint-initdb.d` and declare database names separated by commas in | ||||||
| `POSTGRES_MULTIPLE_DATABASES` environment variable as follows | `POSTGRES_MULTIPLE_DATABASES` environment variable as follows | ||||||
| @ -28,3 +30,21 @@ Clone the repository, mount its directory as a volume into | |||||||
|             - POSTGRES_MULTIPLE_DATABASES=db1,db2 |             - POSTGRES_MULTIPLE_DATABASES=db1,db2 | ||||||
|             - POSTGRES_USER=myapp |             - POSTGRES_USER=myapp | ||||||
|             - POSTGRES_PASSWORD= |             - POSTGRES_PASSWORD= | ||||||
|  | 
 | ||||||
|  | ### By building a custom image | ||||||
|  | 
 | ||||||
|  | Clone the repository, build and push the image to your Docker repository, | ||||||
|  | for example for Google Private Repository do the following: | ||||||
|  | 
 | ||||||
|  |     docker build --tag=eu.gcr.io/your-project/postgres-multi-db | ||||||
|  |     gcloud docker -- push eu.gcr.io/your-project/postgres-multi-db | ||||||
|  | 
 | ||||||
|  | You still need to pass the `POSTGRES_MULTIPLE_DATABASES` environment variable | ||||||
|  | to the container: | ||||||
|  | 
 | ||||||
|  |     myapp-postgresql: | ||||||
|  |         image: eu.gcr.io/your-project/postgres-multi-db | ||||||
|  |         environment: | ||||||
|  |             - POSTGRES_MULTIPLE_DATABASES=db1,db2 | ||||||
|  |             - POSTGRES_USER=myapp | ||||||
|  |             - POSTGRES_PASSWORD= | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user