version: '3.8' services: # Backend API Service backend: build: context: ./backend dockerfile: Dockerfile container_name: research-pilot-backend ports: - "8000:8000" environment: - NODE_ENV=production - PORT=8000 - DATABASE_URL=postgresql://postgres:mysecretpassword@postgres:5432/postgres - REDIS_HOST=redis - REDIS_PORT=6379 - JWT_SECRET=${JWT_SECRET:-your-super-secure-jwt-secret-change-this} - NEWS_API_KEY=${NEWS_API_KEY} - GOOGLE_API_KEY=${GOOGLE_API_KEY} - FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000} depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ./backend/migrations:/app/migrations restart: unless-stopped networks: - research-pilot-network # Worker Service worker: build: context: ./backend dockerfile: Dockerfile container_name: research-pilot-worker environment: - NODE_ENV=production - DATABASE_URL=postgresql://postgres:mysecretpassword@postgres:5432/postgres - REDIS_HOST=redis - REDIS_PORT=6379 - JWT_SECRET=${JWT_SECRET:-your-super-secure-jwt-secret-change-this} - NEWS_API_KEY=${NEWS_API_KEY} - GOOGLE_API_KEY=${GOOGLE_API_KEY} depends_on: postgres: condition: service_healthy redis: condition: service_healthy command: ["npm", "run", "start:worker"] restart: unless-stopped networks: - research-pilot-network # PostgreSQL Database postgres: image: postgres:17-alpine container_name: research-pilot-postgres environment: - POSTGRES_DB=${POSTGRES_DB:-postgres} - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-mysecretpassword} ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data - ./backend/migrations:/docker-entrypoint-initdb.d healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped networks: - research-pilot-network # Redis Cache & Queue redis: image: redis:7-alpine container_name: research-pilot-redis ports: - "6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped networks: - research-pilot-network # Optional: Redis Commander (Redis GUI) redis-commander: image: rediscommander/redis-commander:latest container_name: research-pilot-redis-commander environment: - REDIS_HOSTS=local:redis:6379 ports: - "8081:8081" depends_on: - redis restart: unless-stopped networks: - research-pilot-network profiles: - tools # Optional: pgAdmin (PostgreSQL GUI) pgadmin: image: dpage/pgadmin4:latest container_name: research-pilot-pgadmin environment: - PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL:-admin@research-pilot.com} - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD:-admin} ports: - "8080:80" depends_on: - postgres volumes: - pgadmin_data:/var/lib/pgadmin restart: unless-stopped networks: - research-pilot-network profiles: - tools volumes: postgres_data: driver: local redis_data: driver: local pgadmin_data: driver: local networks: research-pilot-network: driver: bridge