version: "3.9"

services:
  db:
    image: mysql:8.1
    container_name: cloud_remenex_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: mysecretpassword
      MYSQL_DATABASE: cloud_remenex
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: cloud_remenex_phpmyadmin
    restart: always
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
    ports:
      - "8080:80"
    depends_on:
      - db

  nextjs:
    build: .
    container_name: cloud_remenex_next
    ports:
      - "3000:3000"
    command: npm run dev
    volumes:
      - .:/app
      - /app/node_modules
    environment:
      DB_HOST: db
      DB_PORT: 3306
      DB_USERNAME: root
      DB_PASSWORD: mysecretpassword
      DB_NAME: cloud_remenex
    depends_on:
      - db

volumes:
  db_data:
