File size: 1,648 Bytes
bfbdc91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# version: '3.10.11'

services:
  map-wikiread:
    build: 
      context: .
      dockerfile: Dockerfile  # Use the Dockerfile in the current directory
    ports:
      - "8004:8000"  # Expose port 8004 on host to port 8000 in the container
    command: uvicorn main:app --host 0.0.0.0 --reload      
    # command: /bin/sh -c "pip install -r requirements.txt && uvicorn main:app --host 0.0.0.0 --reload"
    environment:
      - MONGODB_URL=mongodb://mongodb-wikiread:27017
      - DATABASE_NAME=wikiread
    volumes:
      - .:/app  # Mount the current directory to /app in the container
    depends_on:
      - mongodb-wikiread  # Ensure MongoDB starts before the backend
    networks:
      - wikiread_network

  mongodb-wikiread:
    image: mongo:latest
    ports:
      - "27017:27017"  # Expose MongoDB on port 27017. Decided not to use another port.
    container_name: mongodb-wikiread
    environment:
      - MONGO_INITDB_ROOT_USERNAME=user
      - MONGO_INITDB_ROOT_PASSWORD=root
    volumes:
      - mongodb_data:/data/db  # Use a volume for persistent MongoDB data
    networks:
      - wikiread_network


  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./frontend:/app
      - /app/node_modules
    environment:
      - REACT_APP_API_URL=http://localhost:8004
    depends_on:
      - map-wikiread
    networks:
      - wikiread_network

networks:
  wikiread_network:
    driver: bridge  # Create a bridge network to connect the backend and MongoDB

volumes:
  mongodb_data:
    driver: local