-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (85 loc) · 1.88 KB
/
docker-compose.yml
File metadata and controls
90 lines (85 loc) · 1.88 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
version: "3.8"
services:
db:
image: mysql:8.0
container_name: expense_system_db
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: expense_system_development
MYSQL_USER: expense_user
MYSQL_PASSWORD: expense_password
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test:
[
"CMD",
"mysqladmin",
"ping",
"-h",
"localhost",
"-u",
"root",
"-prootpassword",
]
interval: 10s
timeout: 5s
retries: 5
networks:
- expense_network
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: expense_system_backend
environment:
RAILS_ENV: development
DATABASE_HOST: db
DATABASE_PORT: 3306
DATABASE_NAME: expense_system_development
DATABASE_USERNAME: expense_user
DATABASE_PASSWORD: expense_password
ports:
- "3000:3000"
depends_on:
db:
condition: service_healthy
volumes:
- ./backend:/rails
- backend_gems:/usr/local/bundle
command: >
sh -c "
bundle install &&
rails db:migrate &&
rails db:seed &&
rails server -b 0.0.0.0
"
networks:
- expense_network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: expense_system_frontend
environment:
VITE_API_URL: http://localhost:3000
ports:
- "5173:5173"
depends_on:
- backend
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
command: npm run dev -- --host
networks:
- expense_network
volumes:
mysql_data:
backend_gems:
frontend_node_modules:
networks:
expense_network:
driver: bridge