-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.yml
101 lines (95 loc) · 2.33 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
98
99
100
101
services:
server:
image: quickgraph-server
build:
context: ./server
dockerfile: Dockerfile
depends_on:
- mongodb
ports:
- "8000:8000"
networks:
- app-network
environment:
- MONGODB__DATABASE_NAME=quickgraph
- MONGODB__URI=mongodb://root:example@mongodb:27017
- AUTH__SECRET_KEY=example
client:
image: quickgraph-client
build:
context: ./client
dockerfile: Dockerfile
ports:
- "8080:80"
depends_on:
- server
- docs
networks:
- app-network
environment:
- VITE_API_BASE_URL=http://localhost:8000/api
- VITE_DOC_BASE_URL=http://localhost:4000
mongodb:
image: mongo:latest
ports:
- "27018:27017"
volumes:
- mongodb_data:/data/db
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=example
networks:
- app-network
docs:
build:
context: ./docs
dockerfile: Dockerfile
ports:
- "4000:4000"
volumes:
- static_img:/app/static/img
networks:
- app-network
depends_on:
- init-static-img
init-static-img:
image: curlimages/curl:latest
user: root
volumes:
- static_img:/app/static/img
healthcheck:
test: ["CMD", "test", "-f", "/app/static/img/.initialized"]
interval: 10s
timeout: 5s
retries: 100
command: >
sh -c '
echo "Starting initialization process..." &&
mkdir -p /app/static/img &&
chmod 777 /app/static/img &&
cd /app/static/img &&
if [ -f .initialized ]; then
echo "Already initialized, skipping download" &&
exit 0
fi &&
echo "Attempting to download static images..." &&
if ! curl -L --progress-bar https://nlp-tlp.s3.ap-southeast-2.amazonaws.com/static-img.tar.gz -o static-img.tar.gz; then
echo "Failed to download static-img.tar.gz" &&
exit 1
fi &&
echo "Download complete, extracting..." &&
if ! tar xzf static-img.tar.gz --strip-components=1; then
echo "Failed to extract archive" &&
exit 1
fi &&
rm static-img.tar.gz &&
touch .initialized &&
chmod -R 755 /app/static/img &&
echo "Initialization complete"
'
volumes:
mongodb_data:
static_img:
networks:
app-network:
driver: bridge