services:
  postgres:
    image: postgres:17.6-alpine3.22
    networks:
      - bot
    restart: always
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: ${PSQL_NAME}
      POSTGRES_USER: ${PSQL_USER}
      POSTGRES_PASSWORD: ${PSQL_PASS}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${PSQL_USER} -d ${PSQL_NAME}"]
      interval: 2s
      retries: 5
      timeout: 10s
    volumes:
      - ./scripts/postgres:/docker-entrypoint-initdb.d
      - postgres_data:/var/lib/postgresql/data
  mongo:
    image: mongo:8.0.14-noble
    networks:
      - bot
    restart: always
    ports:
      - "27017:27017"
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
      MONGO_INITDB_DATABASE: ${MONGO_NAME}
    volumes:
      - ./scripts/mongo:/docker-entrypoint-initdb.d
      - mongo_data:/data/db
  redis:
    image: redis:8.2.1-alpine
    networks:
      - bot
    restart: always
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data

networks:
  bot:
    driver: bridge
volumes:
  postgres_data:
  mongo_data:
  redis_data: