File size: 2,269 Bytes
194aaa5
 
 
 
1c33a73
194aaa5
 
 
 
1c33a73
 
 
194aaa5
 
 
1c33a73
194aaa5
 
 
 
 
 
 
 
 
 
1c33a73
194aaa5
 
 
 
 
 
1c33a73
194aaa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c33a73
194aaa5
 
 
 
 
 
 
 
 
 
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
services:
  # ── PostgreSQL with pgvector ──────────────────────────────────────
  db:
    image: pgvector/pgvector:pg17
    container_name: rednote-db
    restart: unless-stopped
    ports:
      - "${POSTGRES_PORT:-5432}:5432"
    environment:
      POSTGRES_USER: ${POSTGRES_USER:-rednote}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-rednote}
      POSTGRES_DB: ${POSTGRES_DB:-rednote}
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-rednote} -d ${POSTGRES_DB:-rednote}"]
      interval: 5s
      timeout: 5s
      retries: 10
      start_period: 30s

  # ── FastAPI Backend ──────────────────────────────────────────────
  backend:
    build:
      context: .
      dockerfile: backend/Dockerfile.backend
    container_name: rednote-backend
    restart: unless-stopped
    ports:
      - "${BACKEND_PORT:-8000}:8000"
    env_file:
      - backend/.env
    environment:
      DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-rednote}:${POSTGRES_PASSWORD:-rednote}@db:5432/${POSTGRES_DB:-rednote}
      UPLOAD_DIR: /app/uploads
      FASTEMBED_CACHE_PATH: /app/fastembed_cache
      UVICORN_WORKERS: ${UVICORN_WORKERS:-4}
      ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:80}
    volumes:
      - uploads:/app/uploads
      - fastembed_cache:/app/fastembed_cache
    depends_on:
      db:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 15s

  # ── React Frontend (Nginx) ──────────────────────────────────────
  frontend:
    build:
      context: .
      dockerfile: frontend/Dockerfile.frontend
      args:
        VITE_API_URL: /api
    container_name: rednote-frontend
    restart: unless-stopped
    ports:
      - "80:80"
    depends_on:
      - backend

volumes:
  pgdata:
  uploads:
  fastembed_cache: