-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
47 lines (45 loc) · 1.08 KB
/
docker-compose.yml
File metadata and controls
47 lines (45 loc) · 1.08 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
services:
mongo:
image: mongo:7
container_name: mongo
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: adminpassword
MONGO_INITDB_DATABASE: appdb
volumes:
- mongo_data:/data/db
healthcheck:
test:
["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
app:
build:
context: .
dockerfile: Dockerfile
container_name: myapp
restart: unless-stopped
user: root
ports:
- "8000:8000"
depends_on:
mongo:
condition: service_healthy
environment:
MONGO_HOST: mongo
MONGO_PORT: "27017"
MONGO_DB: appdb
MONGO_USER: admin
MONGO_PASSWORD: adminpassword
MONGO_AUTH_DB: admin
JWT_SECRET: "change_me_in_production"
volumes:
- ./:/app:delegated
command: sh -c "sleep 2 && python -m app.db.seed && uvicorn main:app --host 0.0.0.0 --port 8000"
volumes:
mongo_data: