services:
  app:
    build:
      context: .
      dockerfile: docker/Dockerfile
    ports:
      - "8000:8000"
    volumes:
      - .:/var/www/html
    depends_on:
      - postgres
      - redis
    environment:
      APP_ENV: local
      APP_DEBUG: "true"
      DB_HOST: postgres
      REDIS_HOST: redis

  postgres:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_DB: migcheck
      POSTGRES_USER: migcheck
      POSTGRES_PASSWORD: secret
    volumes:
      - postgres_data:/var/lib/postgresql/data

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"

  node:
    image: node:22-alpine
    working_dir: /var/www/html
    volumes:
      - .:/var/www/html
    command: sh -c "npm install && npm run dev -- --host"
    ports:
      - "5173:5173"

volumes:
  postgres_data:
