docker-compose.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. services:
  2. postgres:
  3. image: postgres:16-alpine
  4. container_name: vidreview-db
  5. environment:
  6. POSTGRES_USER: vidreview
  7. POSTGRES_PASSWORD: vidreview123
  8. POSTGRES_DB: vidreview
  9. ports:
  10. - '5432:5432'
  11. volumes:
  12. - postgres_data:/var/lib/postgresql/data
  13. healthcheck:
  14. test: ['CMD-SHELL', 'pg_isready -U vidreview']
  15. interval: 5s
  16. timeout: 5s
  17. retries: 5
  18. api:
  19. build:
  20. context: .
  21. dockerfile: Dockerfile.api
  22. container_name: vidreview-api
  23. environment:
  24. DATABASE_URL: postgresql://vidreview:vidreview123@postgres:5432/vidreview
  25. JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
  26. JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
  27. API_PORT: 3001
  28. NODE_ENV: production
  29. UPLOAD_DIR: /app/uploads
  30. MAX_FILE_SIZE_MB: 500
  31. ALLOWED_ORIGINS: '*'
  32. ports:
  33. - '3001:3001'
  34. depends_on:
  35. postgres:
  36. condition: service_healthy
  37. volumes:
  38. - uploads:/app/uploads
  39. healthcheck:
  40. test: ['CMD-SHELL', 'wget -qO- http://localhost:3001/health || exit 1']
  41. interval: 10s
  42. timeout: 5s
  43. retries: 5
  44. # ── Transcode Worker ──────────────────────────────────────────────────────
  45. # Standalone Node.js process that polls the DB for pending transcode jobs.
  46. # Runs FFmpeg off the main API thread — uploads never block.
  47. worker:
  48. build:
  49. context: .
  50. dockerfile: Dockerfile.api
  51. container_name: vidreview-worker
  52. command: node src/worker/index.js
  53. environment:
  54. DATABASE_URL: postgresql://vidreview:vidreview123@postgres:5432/vidreview
  55. NODE_ENV: production
  56. UPLOAD_DIR: /app/uploads
  57. POLL_INTERVAL_MS: 2000
  58. depends_on:
  59. postgres:
  60. condition: service_healthy
  61. volumes:
  62. - uploads:/app/uploads
  63. restart: unless-stopped
  64. frontend:
  65. build:
  66. context: .
  67. dockerfile: Dockerfile.frontend
  68. container_name: vidreview-frontend
  69. environment:
  70. NEXT_PUBLIC_API_URL: http://api:3001
  71. NODE_ENV: production
  72. ports:
  73. - '3000:3000'
  74. depends_on:
  75. api:
  76. condition: service_healthy
  77. volumes:
  78. postgres_data:
  79. uploads: