mirror of
https://github.com/bitnami/containers.git
synced 2026-03-19 15:57:46 +08:00
adds postgresql support
This commit is contained in:
20
bitnami/express/docker-compose-postgresql.yml
Normal file
20
bitnami/express/docker-compose-postgresql.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
postgresql:
|
||||
image: bitnami/postgresql:latest
|
||||
environment:
|
||||
- POSTGRESQL_DATABASE=my_app_development
|
||||
|
||||
myapp:
|
||||
tty: true # Enables debugging capabilities when attached to this container.
|
||||
image: bitnami/express:latest
|
||||
environment:
|
||||
- PORT=3000
|
||||
- DATABASE_URL=postgres://postgres@postgresql/my_app_development
|
||||
depends_on:
|
||||
- postgresql
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- .:/app
|
||||
@@ -19,7 +19,7 @@ dependencies_up_to_date() {
|
||||
}
|
||||
|
||||
database_tier_exists() {
|
||||
[ -n "$(getent hosts mongodb mariadb)" ]
|
||||
[ -n "$(getent hosts mongodb mariadb postgresql)" ]
|
||||
}
|
||||
|
||||
__wait_for_db() {
|
||||
@@ -50,6 +50,10 @@ wait_for_db() {
|
||||
if getent hosts mariadb >/dev/null; then
|
||||
__wait_for_db mariadb 3306
|
||||
fi
|
||||
|
||||
if getent hosts postgresql >/dev/null; then
|
||||
__wait_for_db postgresql 5432
|
||||
fi
|
||||
}
|
||||
|
||||
add_database_support() {
|
||||
@@ -60,6 +64,10 @@ add_database_support() {
|
||||
if getent hosts mariadb >/dev/null && ! npm ls mysql >/dev/null; then
|
||||
npm install --save mysql
|
||||
fi
|
||||
|
||||
if getent hosts postgresql >/dev/null && ! npm ls pg pg-hstore >/dev/null; then
|
||||
npm install --save pg pg-hstore
|
||||
fi
|
||||
}
|
||||
|
||||
log () {
|
||||
|
||||
Reference in New Issue
Block a user