-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
53 lines (48 loc) · 1.18 KB
/
compose.yaml
File metadata and controls
53 lines (48 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
services:
# redis container
redis:
image: redis:8.6.2
expose:
- 6379
# postgres container
postgres_db:
image: postgres:18.3
expose:
- 5432
environment: # must have postgres env variables to initialize postgres database
POSTGRES_USER: user1
POSTGRES_DB: notes_db
POSTGRES_PASSWORD_FILE: /run/secrets/database_password
secrets:
- database_password
volumes: # persistent volume
- all-notes-data:/var/lib/postgresql
# backend api container
express_api:
depends_on:
- postgres_db
- redis
build: ./backend
ports:
- "5000:5000"
environment:
NODE_ENV: production
REDIS_URL: redis://redis:6379 # used redis container hostname
DB_USER: user1
DB_NAME: notes_db
DB_HOST: postgres_db
DB_PORT: 5432
secrets: # mounts the password at /run/secrets/database_password to be read by getDatabasePassword() function
- database_password
# react build container
nginx_web_server:
depends_on:
- express_api
build: ./frontend
ports:
- "8080:80"
secrets:
database_password:
file: ./db-password.txt
volumes:
all-notes-data: