services:
  redis:
    image: redis:7-alpine
    restart: unless-stopped
    ports:
      - "6379:6379"
    volumes:
      - redis-data:/data

  bot:
    image: node:20-alpine
    working_dir: /app
    command: sh -c "npm install && npm run build && npm start"
    restart: unless-stopped
    env_file:
      - .env
    environment:
      REDIS_HOST: redis
      RUN_EMBEDDED_WORKERS: "false"
    depends_on:
      - redis
    ports:
      - "3000:3000"
    volumes:
      - ./:/app

  worker:
    image: node:20-alpine
    working_dir: /app
    command: sh -c "npm install && npm run build && npm run start:worker"
    restart: unless-stopped
    env_file:
      - .env
    environment:
      REDIS_HOST: redis
    depends_on:
      - redis
    volumes:
      - ./:/app

volumes:
  redis-data:
