|
| 1 | +# ============================================================================= |
| 2 | +# TaskFlow Platform - Development Docker Compose |
| 3 | +# ============================================================================= |
| 4 | +# Development stack with hot reloading for all services |
| 5 | +# |
| 6 | +# Uses Dockerfile.dev for each service with: |
| 7 | +# - Polling-based file watching (macOS Docker compatible) |
| 8 | +# - Hot reload commands built-in |
| 9 | +# |
| 10 | +# Usage: |
| 11 | +# ./docker-dev.sh # Start dev environment |
| 12 | +# ./docker-dev.sh --logs # Start and follow logs |
| 13 | +# ./docker-dev.sh --clean # Clean volumes and restart |
| 14 | +# |
| 15 | +# Hot Reload: |
| 16 | +# - Python: uvicorn --reload with polling |
| 17 | +# - Next.js: Fast Refresh with polling |
| 18 | +# ============================================================================= |
| 19 | + |
| 20 | +name: taskflow-dev |
| 21 | + |
| 22 | +services: |
| 23 | + # =========================================================================== |
| 24 | + # PostgreSQL Database (shared with production) |
| 25 | + # =========================================================================== |
| 26 | + postgres: |
| 27 | + image: postgres:16-alpine |
| 28 | + environment: |
| 29 | + POSTGRES_USER: postgres |
| 30 | + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} |
| 31 | + POSTGRES_DB: taskflow |
| 32 | + volumes: |
| 33 | + - postgres_data:/var/lib/postgresql/data |
| 34 | + ports: |
| 35 | + - "5432:5432" |
| 36 | + healthcheck: |
| 37 | + test: ["CMD-SHELL", "pg_isready -U postgres -d taskflow"] |
| 38 | + interval: 10s |
| 39 | + timeout: 5s |
| 40 | + retries: 5 |
| 41 | + start_period: 10s |
| 42 | + restart: unless-stopped |
| 43 | + networks: |
| 44 | + - taskflow-network |
| 45 | + |
| 46 | + # =========================================================================== |
| 47 | + # pgAdmin (Database UI) |
| 48 | + # =========================================================================== |
| 49 | + pgadmin: |
| 50 | + image: dpage/pgadmin4:latest |
| 51 | + environment: |
| 52 | + - PGADMIN_DEFAULT_EMAIL=admin@example.com |
| 53 | + - PGADMIN_DEFAULT_PASSWORD=admin |
| 54 | + - PGADMIN_CONFIG_SERVER_MODE=False |
| 55 | + - PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False |
| 56 | + ports: |
| 57 | + - "5050:80" |
| 58 | + volumes: |
| 59 | + - pgadmin_data:/var/lib/pgadmin |
| 60 | + - ./pgadmin-servers.json:/pgadmin4/servers.json:ro |
| 61 | + depends_on: |
| 62 | + postgres: |
| 63 | + condition: service_healthy |
| 64 | + restart: unless-stopped |
| 65 | + networks: |
| 66 | + - taskflow-network |
| 67 | + |
| 68 | + # =========================================================================== |
| 69 | + # SSO Platform (Better Auth) - Development with Hot Reload |
| 70 | + # =========================================================================== |
| 71 | + sso-platform: |
| 72 | + build: |
| 73 | + context: ./sso-platform |
| 74 | + dockerfile: Dockerfile.dev |
| 75 | + environment: |
| 76 | + - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow?sslmode=disable |
| 77 | + - BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET} |
| 78 | + - BETTER_AUTH_URL=http://localhost:3001 |
| 79 | + - NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3001 |
| 80 | + - ALLOWED_ORIGINS=http://localhost:3000,http://localhost:8000,http://web-dashboard:3000,http://api:8000 |
| 81 | + - DISABLE_EMAIL_VERIFICATION=true |
| 82 | + volumes: |
| 83 | + - ./sso-platform:/app |
| 84 | + - /app/node_modules |
| 85 | + - /app/.next |
| 86 | + ports: |
| 87 | + - "3001:3001" |
| 88 | + depends_on: |
| 89 | + postgres: |
| 90 | + condition: service_healthy |
| 91 | + restart: unless-stopped |
| 92 | + networks: |
| 93 | + - taskflow-network |
| 94 | + |
| 95 | + # =========================================================================== |
| 96 | + # TaskFlow API (FastAPI) - Development with Hot Reload |
| 97 | + # =========================================================================== |
| 98 | + api: |
| 99 | + build: |
| 100 | + context: ./packages/api |
| 101 | + dockerfile: Dockerfile.dev |
| 102 | + environment: |
| 103 | + - DATABASE_URL=postgresql+asyncpg://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow |
| 104 | + - SSO_URL=http://sso-platform:3001 |
| 105 | + - ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001,http://web-dashboard:3000,http://sso-platform:3001 |
| 106 | + - DEBUG=true |
| 107 | + - LOG_LEVEL=DEBUG |
| 108 | + - DEV_MODE=true |
| 109 | + - MCP_SERVER_URL=http://mcp-server:8001/mcp |
| 110 | + - OPENAI_API_KEY=${OPENAI_API_KEY} |
| 111 | + - TASKFLOW_CHATKIT_DATABASE_URL=${TASKFLOW_CHATKIT_DATABASE_URL:-postgresql+asyncpg://postgres:${POSTGRES_PASSWORD:-postgres}@postgres:5432/taskflow} |
| 112 | + volumes: |
| 113 | + - ./packages/api/src:/app/src |
| 114 | + ports: |
| 115 | + - "8000:8000" |
| 116 | + depends_on: |
| 117 | + postgres: |
| 118 | + condition: service_healthy |
| 119 | + restart: unless-stopped |
| 120 | + networks: |
| 121 | + - taskflow-network |
| 122 | + |
| 123 | + # =========================================================================== |
| 124 | + # MCP Server (HTTP transport) - Development with Hot Reload |
| 125 | + # =========================================================================== |
| 126 | + mcp-server: |
| 127 | + build: |
| 128 | + context: ./packages/mcp-server |
| 129 | + dockerfile: Dockerfile.dev |
| 130 | + environment: |
| 131 | + - TASKFLOW_API_URL=http://api:8000 |
| 132 | + - TASKFLOW_MCP_HOST=0.0.0.0 |
| 133 | + - TASKFLOW_MCP_PORT=8001 |
| 134 | + - TASKFLOW_DEV_MODE=true |
| 135 | + - TASKFLOW_API_TIMEOUT=30.0 |
| 136 | + volumes: |
| 137 | + - ./packages/mcp-server/src:/app/src |
| 138 | + ports: |
| 139 | + - "8001:8001" |
| 140 | + depends_on: |
| 141 | + postgres: |
| 142 | + condition: service_healthy |
| 143 | + restart: unless-stopped |
| 144 | + networks: |
| 145 | + - taskflow-network |
| 146 | + |
| 147 | + # =========================================================================== |
| 148 | + # Web Dashboard (Next.js) - Development with Fast Refresh |
| 149 | + # =========================================================================== |
| 150 | + web-dashboard: |
| 151 | + build: |
| 152 | + context: ./web-dashboard |
| 153 | + dockerfile: Dockerfile.dev |
| 154 | + environment: |
| 155 | + # Browser URLs (used by client-side code) |
| 156 | + - NEXT_PUBLIC_SSO_URL=http://localhost:3001 |
| 157 | + - NEXT_PUBLIC_API_URL=http://localhost:8000 |
| 158 | + - NEXT_PUBLIC_OAUTH_CLIENT_ID=taskflow-sso-public-client |
| 159 | + - NEXT_PUBLIC_OAUTH_REDIRECT_URI=http://localhost:3000/api/auth/callback |
| 160 | + - NEXT_PUBLIC_OAUTH_SCOPE=openid profile email |
| 161 | + - NEXT_PUBLIC_CHATKIT_DOMAIN_KEY=${NEXT_PUBLIC_CHATKIT_DOMAIN_KEY:-domain_pk_local_dev} |
| 162 | + # Server URLs (used by API routes) |
| 163 | + - SERVER_API_URL=http://api:8000 |
| 164 | + - SERVER_SSO_URL=http://sso-platform:3001 |
| 165 | + volumes: |
| 166 | + - ./web-dashboard:/app |
| 167 | + - /app/node_modules |
| 168 | + - /app/.next |
| 169 | + ports: |
| 170 | + - "3000:3000" |
| 171 | + depends_on: |
| 172 | + postgres: |
| 173 | + condition: service_healthy |
| 174 | + restart: unless-stopped |
| 175 | + networks: |
| 176 | + - taskflow-network |
| 177 | + |
| 178 | +networks: |
| 179 | + taskflow-network: |
| 180 | + driver: bridge |
| 181 | + |
| 182 | +volumes: |
| 183 | + postgres_data: |
| 184 | + pgadmin_data: |
| 185 | + |
| 186 | +# ============================================================================= |
| 187 | +# HOT RELOAD: |
| 188 | +# - Edit src/ files → auto-reload in ~3-5 seconds |
| 189 | +# - Dependencies installed in Docker image (not mounted) |
| 190 | +# - Only src/ and public/ folders are mounted for hot reload |
| 191 | +# ============================================================================= |
0 commit comments