-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
79 lines (72 loc) · 1.86 KB
/
docker-compose.yml
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
version: '3.9'
# name the resulting compose project after the name of the instance
# this enables us to easily host multiple instances on a single machine
name: ${INSTANCE_NAME:-self-hosted-api-trader-game}
services:
traefik:
image: 'traefik:v3.3.0'
container_name: 'Reverse-Proxy'
command:
- '--providers.docker=true'
- '--providers.docker.exposedbydefault=false'
- '--entrypoints.web.address=:80'
ports:
- 80:80
depends_on:
- backend
- frontend
restart: always
volumes:
- '/var/run/docker.sock:/var/run/docker.sock:ro'
networks:
- internal
backend:
build: ./backend
image: ${IMAGE_NAME}
depends_on:
- database
networks:
- internal
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.backend.rule=PathRegexp(`\/(api|\.well-known).*`)'
- 'traefik.http.services.backend.loadbalancer.server.port=8080'
environment:
- INSTANCE_NAME=${INSTANCE_NAME}
- DATABASE_HOST=database
# TODO this should be the same as the reverse proxy address, once we have it
- BASE_URL=http://localhost
frontend:
build:
context: ./frontend
args:
- COMMIT_HASH=abcdefg
image: ${IMAGE_NAME_FRONTEND}
depends_on:
- backend
networks:
- internal
environment:
- INSTANCE_NAME=${INSTANCE_NAME}
- DATABASE_HOST=database
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.frontend.rule=PathPrefix(`/`)'
- 'traefik.http.services.frontend.loadbalancer.server.port=3000'
database:
image: postgres:16.6
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: nest
restart: always
ports:
- 5432:5432
networks:
- internal
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
networks:
internal: