forked from Txio-labs/txio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (79 loc) · 2.46 KB
/
Copy pathdocker-compose.yml
File metadata and controls
82 lines (79 loc) · 2.46 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
services:
mongodb:
image: mongo:7.0
container_name: txio-db
# Root credentials (MONGO_INITDB_ROOT_USERNAME / MONGO_INITDB_ROOT_PASSWORD) are
# injected into the container by env_file below; mongod --auth reads them at
# startup. Do NOT redeclare them in an environment: block using ${VAR} -- Compose
# resolves that from the shell / project-root .env, not from env_file, and an
# explicit environment: key would overwrite the real value with an empty string.
env_file:
- ./backend/api/.env
command: mongod --auth
# Port mapping intentionally omitted: only the api service needs to reach Mongo,
# and the default compose network already allows that. Publishing 27017 to the
# host would expose the database to anything that can connect to it.
volumes:
- mongodb_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
api:
build:
context: .
dockerfile: ./Dockerfile
container_name: txio-api
# Secrets (JWT_SECRET, BREVO_API_KEY, GROQ_API_KEYS, MONGO_URI, ...) come from
# this untracked file. Copy .env.example to backend/api/.env and fill it in.
# MONGO_URI is read from the same file at runtime (see config.rs), so
# contributors set the credentialed MongoDB URI once and both mongo --auth
# (via MONGO_INITDB_ROOT_*) and the API (via MONGO_URI) read that one file.
# The API fails fast if JWT_SECRET is missing or <32 chars (see config.rs).
env_file:
- ./backend/api/.env
environment:
RUST_LOG: info
PORT: 8000
ports:
- "8000:8000"
depends_on:
mongodb:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 15s
timeout: 5s
retries: 5
start_period: 30s
deploy:
resources:
limits:
cpus: "2.0"
memory: 1G
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
container_name: txio-frontend
ports:
- "5173:80"
depends_on:
api:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
volumes:
mongodb_data: