-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
97 lines (90 loc) · 2.69 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
version: "3.7"
services:
proxy:
image: traefik:v2.9.10
restart: on-failure
command:
- "--log.level=DEBUG"
- "--api=true"
- "--api.dashboard=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.frontend.address=:${FRONTEND_PORT}"
- "--entrypoints.backend.address=:${BACKEND_PORT}"
ports:
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
- "${BACKEND_PORT}:${BACKEND_PORT}"
- "8080:8080"
volumes:
- type: bind
source: /var/run/docker.sock
target: /var/run/docker.sock
read_only: true
frontend:
build:
context: frontend
# environment variables for the frontend have to be passed as build args
# because they need to be set when the frontend build is created
# (which they are not when using the normal 'environment' section of a service)
args:
- FRONTEND_PORT=${FRONTEND_PORT}
- VITE_API_HOST=0.0.0.0
- VITE_PORT=${FRONTEND_PORT}
- VITE_API_HOST=localhost:${BACKEND_PORT}
- VITE_REST_API_PROTOCOL=http://
- VITE_WS_API_PROTOCOL=ws://
- VITE_APP_TITLE=${FRONTEND_APP_TITLE}
restart: on-failure
environment:
- FRONTEND_PORT=${FRONTEND_PORT}
expose:
- "${FRONTEND_PORT}"
volumes:
- type: bind
source: ./frontend
target: /frontend
read_only: true
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.entrypoints=frontend"
- "traefik.http.routers.frontend.rule=Host(`localhost`)"
backend:
build:
context: backend
target: "${BACKEND_DOCKER_TARGET}"
restart: on-failure
environment:
- ENV=development
- BACKEND_ADDRESS=0.0.0.0:${BACKEND_PORT}
- DB_CONNECTION_TIMEOUT_MS=10000
- DB_CONNECTION_URL=mongodb://${DB_USERNAME}:${DB_PASSWORD}@database:${DB_PORT}
- DB_NAME=kanban
- PUBSUB_CONNECTION_URL=nats://pubsub:${PUBSUB_PORT}
- ALLOWED_ORIGINS=${BACKEND_ALLOWED_ORIGINS}
expose:
- "${BACKEND_PORT}"
volumes:
- type: bind
source: ./backend
target: /backend
read_only: true
depends_on:
- database
- pubsub
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.entrypoints=backend"
- "traefik.http.routers.backend.rule=Host(`localhost`)"
database:
image: mongo:6.0.5
restart: on-failure
environment:
MONGO_INITDB_ROOT_USERNAME: ${DB_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD}
volumes:
- mongodb_data_container:/data/database
pubsub:
image: nats:2.9.16
restart: on-failure
volumes:
mongodb_data_container: { }