-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-example.yaml
37 lines (33 loc) · 1.08 KB
/
docker-compose-example.yaml
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
version: '3.8'
services:
mongodb:
image: mongo:latest
container_name: mongodb
restart: unless-stopped
ports:
- "27017:27017" # Expose MongoDB on the host port 27017
environment:
MONGO_INITDB_ROOT_USERNAME: mongoadmin #replace with your own username
MONGO_INITDB_ROOT_PASSWORD: mongopass #replace with your own password
volumes:
- mongodb_data:/data/db # Mount a volume for MongoDB data persistence
- ./database:/data/import # Mount the local directory with JSON data files into the container
- ./import_json.sh:/docker-entrypoint-initdb.d/import_json.sh # Mount the import json script
networks:
- mongo-network
fastapi:
build: .
container_name: viro3d-api
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- ../static:/viro-3d-api/static
env_file:
- .env # Use the environment variables from the .env file
networks:
- mongo-network
volumes:
mongodb_data: # Define volume for persistent database storage
networks:
mongo-network: # Define a network for MongoDB