File size: 2,925 Bytes
59abb4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fa287a
59abb4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
version: "3.9"

# ── Local development stack ────────────────────────────────────────────────────
# Usage:
#   docker compose up -d
#   docker compose logs -f backend        # watch logs
#   docker compose exec backend python graph_seeder.py   # seed real data
#
# Frontend: http://localhost:3000
# Backend:  http://localhost:8000
# Neo4j Browser: http://localhost:7474  (neo4j / clinicalmatch2024)

services:

  # ── Neo4j Community (free, no expiry) ────────────────────────────────────────
  neo4j:
    image: neo4j:5.18-community
    container_name: clinicalmatch-neo4j
    restart: unless-stopped
    ports:
      - "7474:7474"    # Neo4j Browser
      - "7687:7687"    # Bolt
    volumes:
      - neo4j_data:/data
      - neo4j_logs:/logs
    environment:
      NEO4J_AUTH: "neo4j/clinicalmatch2024"
      NEO4J_PLUGINS: '["apoc"]'
      NEO4J_dbms_security_procedures_unrestricted: "apoc.*"
      NEO4J_dbms_security_procedures_allowlist: "apoc.*"
      NEO4J_server_memory_heap_initial__size: "512m"
      NEO4J_server_memory_heap_max__size: "1g"
      NEO4J_server_memory_pagecache_size: "256m"
      NEO4J_dbms_logs_query_enabled: "OFF"
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://localhost:7476 || exit 1"]
      interval: 20s
      timeout: 10s
      retries: 10
      start_period: 60s

  # ── FastAPI backend ───────────────────────────────────────────────────────────
  backend:
    build:
      context: .
      dockerfile: docker/Dockerfile.backend
    container_name: clinicalmatch-backend
    restart: unless-stopped
    ports:
      - "8000:8000"
    depends_on:
      neo4j:
        condition: service_healthy
    env_file: .env.local
    environment:
      NEO4J_URI: "bolt://neo4j:7687"
      NEO4J_USERNAME: "neo4j"
      NEO4J_PASSWORD: "clinicalmatch2024"
      NEO4J_DATABASE: "neo4j"
    command: >
      sh -c "python3 neo4j_setup.py &&
             python3 data_ingestion.py &&
             uvicorn main:app --host 0.0.0.0 --port 8000 --workers 2"
    volumes:
      - ./backend:/app   # hot-reload for local dev
    working_dir: /app

  # ── Next.js frontend ──────────────────────────────────────────────────────────
  frontend:
    build:
      context: .
      dockerfile: docker/Dockerfile.frontend
    container_name: clinicalmatch-frontend
    restart: unless-stopped
    ports:
      - "3000:3000"
    depends_on:
      - backend
    environment:
      NEXT_PUBLIC_API_URL: "http://localhost:8000"

volumes:
  neo4j_data:
  neo4j_logs: