version: "3.9"

services:
  app:
    build: .
    ports:
      - "3000:3000"
    env_file: .env
    depends_on:
      - db
      - redis
    restart: unless-stopped

  worker:
    build: .
    command: ["node", "node_modules/.bin/tsx", "workers/fetch-runner.ts"]
    env_file: .env
    depends_on:
      - db
      - redis
    restart: unless-stopped

  db:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: khabar
      POSTGRES_PASSWORD: khabar
      POSTGRES_DB: khabar_now
    volumes:
      - db_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  redis:
    image: redis:7-alpine
    volumes:
      - redis_data:/data
    ports:
      - "6379:6379"

volumes:
  db_data:
  redis_data:
