services:
  redis:
    image: redis:7-alpine
    command: redis-server --requirepass mawidi_redis_pass_2025
    ports:
      - "127.0.0.1:6379:6379"
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "-a", "mawidi_redis_pass_2025", "ping"]
      interval: 5s
      timeout: 5s
      retries: 5

  mailhog:
    image: mailhog/mailhog:latest
    ports:
      - "127.0.0.1:1025:1025"
      - "127.0.0.1:8025:8025"

  mawidi-app:
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}
        - NEXT_PUBLIC_CONVEX_URL=${NEXT_PUBLIC_CONVEX_URL}
        - NEXT_PUBLIC_APP_URL=http://localhost:9000
        - NEXT_PUBLIC_STRIPE_PUBLIC_KEY=${NEXT_PUBLIC_STRIPE_PUBLIC_KEY}
        - CONVEX_DEPLOYMENT=${CONVEX_DEPLOYMENT}
    ports:
      - "9000:9000"
    env_file:
      - .env.local
    environment:
      REDIS_URL: redis://:mawidi_redis_pass_2025@redis:6379
      SMTP_HOST: mailhog
      SMTP_PORT: 1025
      NEXT_PUBLIC_APP_URL: http://localhost:9000
      NEXTAUTH_URL: http://localhost:9000
    depends_on:
      redis:
        condition: service_healthy
    restart: unless-stopped

volumes:
  redis_data:
