Repository navigation
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
117 lines (110 loc) · 2.67 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
117 lines (110 loc) · 2.67 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
version: '3.8'
services:
postgres:
build:
context: ./database
dockerfile: Dockerfile
container_name: bookmark_postgres
environment:
POSTGRES_DB: bookmark_manager
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- bookmark_network
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: bookmark_backend
depends_on:
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql://postgres:password@postgres:5432/bookmark_manager
- SERVER_PORT=8000
- RUST_LOG=info
ports:
- "8000:8000"
command: >
sh -c "
echo 'Waiting for database...' &&
sleep 2 &&
diesel migration run &&
echo 'Starting bookmark manager...' &&
./bookmark_manager
"
volumes:
- ./backend/migrations:/app/migrations
networks:
- bookmark_network
restart: unless-stopped
frontend:
build:
context: ./frontend
container_name: bookmark_frontend
ports:
- "3000:3000"
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- ./frontend:/app
- /app/node_modules
stdin_open: true
tty: true
networks:
- bookmark_network
restart: unless-stopped
# test:
# build:
# context: ./backend
# dockerfile: Dockerfile.test
# container_name: bookmark_tests
# depends_on:
# postgres:
# condition: service_healthy
# environment:
# - DATABASE_URL=postgresql://postgres:password@postgres:5432/bookmark_manager
# - RUST_LOG=info
# command: >
# sh -c "
# echo '========================================' &&
# echo ' Running automated tests...' &&
# echo '========================================' &&
# sleep 3 &&
# diesel migration run &&
# cargo test -- --nocapture &&
# echo '========================================' &&
# echo ' All tests completed!' &&
# echo '========================================' &&
# exit 0
# "
# networks:
# - bookmark_network
# restart: "no"
nginx:
image: nginx:alpine
container_name: bookmark_nginx
ports:
- "8080:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- backend
- frontend
networks:
- bookmark_network
restart: unless-stopped
volumes:
postgres_data:
networks:
bookmark_network:
driver: bridge