-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
132 lines (124 loc) · 3.47 KB
/
Copy pathdocker-compose.yml
File metadata and controls
132 lines (124 loc) · 3.47 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# this file initialises the Axum, Python, Rocket, Redis and PostgresDB containers
services:
postgres:
image: postgres:latest
container_name: postgres_db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-admin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret}
POSTGRES_DB: ${POSTGRES_DB:-mydb}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql
- ./init_script.sql:/docker-entrypoint-initdb.d/init_script.sql # mount directly
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${POSTGRES_USER:-admin} -d ${POSTGRES_DB:-mydb}",
]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:alpine
container_name: redis_score
restart: unless-stopped
ports:
- "6379:6379"
axum_be:
build:
context: ./Axum
dockerfile: Dockerfile
container_name: axum_be
restart: unless-stopped
ports:
- "3001:3000"
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-admin}:${POSTGRES_PASSWORD:-secret}@postgres:5432/${POSTGRES_DB:-mydb}
REDIS_URL: redis://redis:6379
DJANGO_URL: http://python_be:8000
depends_on:
postgres:
condition: service_healthy
python_be:
environment:
POSTGRES_USER: ${POSTGRES_USER:-admin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-secret}
POSTGRES_DB: ${POSTGRES_DB:-mydb}
POSTGRES_HOST: postgres
REDIS_HOST: redis
build:
context: ./PythonApp
dockerfile: Dockerfile
container_name: python_be
restart: unless-stopped
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
command: >
sh -c "python manage.py migrate --noinput &&
python manage.py runserver 0.0.0.0:8000"
rocket_app:
build:
context: ./rust_rocket_app
dockerfile: Dockerfile
container_name: rocket_app
restart: unless-stopped
ports:
- "8001:8000"
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-admin}:${POSTGRES_PASSWORD:-secret}@postgres:5432/${POSTGRES_DB:-mydb}
ROCKET_ADDRESS: "0.0.0.0"
JWT_SECRET: "87e6d51c9b951767ab3dc614e44046a0dc66677bcf3a00a053e4d1c1d3656b2c"
FRONTEND_URL: "http://localhost:8001"
depends_on:
postgres:
condition: service_healthy
loco_be:
build:
context: ./Loco/locoapp
dockerfile: Dockerfile
container_name: loco_be
restart: unless-stopped
# Using '|' (pipe) is safer for complex scripts to preserve line breaks
command: >
sh -c "
if [ ! -f /app/data/locoapp.sqlite ]; then
echo 'Database not found. Initializing...';
mkdir -p /app/data && ./locoapp db migrate && ./locoapp db seed;
else
echo 'Database exists. Skipping seed.';
./locoapp db migrate;
fi;
./locoapp start
"
ports:
- "5150:5150"
environment:
DATABASE_URL: sqlite:///app/data/locoapp.sqlite?mode=rwc
LOCO_ENV: development
volumes:
- loco_sqlite_data:/app/data
loco_fe:
build:
context: ./Loco/locoapp/frontend
dockerfile: Dockerfile
container_name: loco_fe
volumes:
- ./Loco/locoapp/frontend:/app # Mount your code for live-reload
- /app/node_modules
restart: unless-stopped
ports:
- "3000:3000"
environment:
VITE_API_URL: http://localhost:5150
depends_on:
- loco_be
volumes:
postgres_data:
loco_sqlite_data: