Skip to content

Commit d8aaf76

Browse files
committed
Use a .env file to manage environment variables
[refs #5eda42a882d4]
1 parent f4e6138 commit d8aaf76

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

compose_example/.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
POSTGRES_DB=web_app_db
2+
POSTGRES_USER=app
3+
POSTGRES_PASSWORD=secret
4+
POSTGRES_HOST=pg

compose_example/docker-compose.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ services:
1010

1111
pg:
1212
image: postgres:9.6-alpine
13-
env_file:
14-
- ./db.env
13+
environment:
14+
- POSTGRES_DB
15+
- POSTGRES_USER
16+
- POSTGRES_PASSWORD
1517
volumes:
1618
- pg-data:/var/lib/postgresql/data
1719

1820
webapp:
1921
image: jfahrer/demo_web_app:latest
2022
ports:
2123
- 9292:9292
22-
env_file:
23-
- ./db.env
24-
- ./app.env
24+
environment:
25+
- POSTGRES_DB
26+
- POSTGRES_USER
27+
- POSTGRES_PASSWORD
28+
- POSTGRES_HOST
2529

2630
alpine:
2731
image: alpine:latest

0 commit comments

Comments
 (0)