version: "3.9"

services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    env_file: .env
    ports:
      - "3000:3000"
    depends_on:
      - postgres
      - redis
    restart: unless-stopped

  worker:
    build:
      context: .
      dockerfile: docker/Dockerfile
    command: ["npm", "run", "worker"]
    env_file: .env
    depends_on:
      - postgres
      - redis
    restart: unless-stopped

  postgres:
    image: postgres:16-alpine
    environment:
      POSTGRES_USER: smm_user
      POSTGRES_PASSWORD: smm_password
      POSTGRES_DB: smm_panel
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: unless-stopped

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

volumes:
  pgdata:
  redisdata:
