services:
  marketplace-api:
    build: .
    ports:
      - "8090:80"
    environment:
      APP_ENV: local
      APP_DEBUG: "true"
      DB_HOST: mysql
      DB_DATABASE: marketplace_residentepro
      DB_USERNAME: marketplace
      DB_PASSWORD: marketplace_secret
      JWT_SECRET: ${JWT_SECRET:-dev-jwt-secret-change-in-production}
    depends_on:
      mysql:
        condition: service_healthy
    volumes:
      - .:/var/www/html

  mysql:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: marketplace_residentepro
      MYSQL_USER: marketplace
      MYSQL_PASSWORD: marketplace_secret
      MYSQL_ROOT_PASSWORD: root_secret
    ports:
      - "3307:3306"
    volumes:
      - marketplace_mysql_data:/var/lib/mysql
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 5s
      timeout: 5s
      retries: 10

volumes:
  marketplace_mysql_data:
