-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yaml
79 lines (74 loc) · 2.05 KB
/
docker-compose.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
services:
local-database:
container_name: thoughts-database
image: "postgres:17-alpine"
restart: always
profiles:
- dev
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: thoughts
ports:
- 5432:5432
volumes:
- database-data:/var/lib/postgresql/data # store data from postgresql in the volume
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # init database with SQL files from local "database" folder
database:
container_name: thoughts-database
image: "postgres:17-alpine"
restart: always
profiles:
- prod
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: thoughts
ports:
- 3000:5432
networks:
- thoughts-network
volumes:
- database-data:/var/lib/postgresql/data # store data from postgresql in the volume
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # init database with SQL files from local "database" folder
backend:
container_name: thoughts-backend
image: fredrikj31/thoughts-backend:latest
restart: always
profiles:
- prod
environment:
WEBSITE_BASE_URL: ${WEBSITE_BASE_URL}
JWT_PRIVATE_KEY: ${JWT_PRIVATE_KEY}
PASSWORD_SALT: ${PASSWORD_SALT}
DB_HOST: thoughts-database
DB_PORT: 5432 # Must be set to "5432", because the backend and database shares network
DB_NAME: thoughts
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
networks:
- thoughts-network
- cloudflared_tunnel
ports:
- 3001:3000
frontend:
container_name: thoughts-frontend
image: fredrikj31/thoughts-frontend:latest
restart: always
profiles:
- prod
environment:
MY_APP_API_BASE_URL: ${MY_APP_API_BASE_URL}
networks:
- cloudflared_tunnel
ports:
- 3002:80
networks:
thoughts-network:
driver: bridge
cloudflared_tunnel:
external: true
volumes:
database-data:
name: thoughts-database-data
driver: local