services:
  nginx:
    image: nginx
    volumes:
      - ./.docker/nginx_templates:/etc/nginx/templates
      # Generar los certificados con sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt (por ejemplo)
      - ./.docker/certificados_ssl:/etc/nginx/certs
    ports:
      - "80:80"
      - "443:443"
    environment:
      - NGINX_HOST=local-bpanel.test
      - NGINX_PORT=443
    depends_on:
      - apache
    networks:
      red_local_bpanel:
  mysql_bpanel:
    image: mariadb:10.5
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: bttcr
    volumes:
      - ./.docker/mysql/volume:/var/lib/mysql/
    networks:
      red_local_bpanel:
  mysql_bpanel_test:
    image: mariadb:10.5
    environment:
      MYSQL_ROOT_PASSWORD: bttcr
      MYSQL_DATABASE: laravel
    volumes:
      - ./.docker/mysql_test/volume:/var/lib/mysql/
    networks:
      red_local_bpanel_test:
  apache:
    build: .docker/php
    depends_on:
      - mysql_bpanel
    ports:
      - "88:80"
      - "448:443"
    volumes:
      - ./:/var/www/html/
    links:
      - mysql_bpanel
      - mysql_bpanel_test
    environment:
      PHP_IDE_CONFIG: "serverName=localhost"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      red_local_bpanel:
      red_local_bpanel_test:
  vite:
    image: node
    volumes:
      - ./:/laravel
    working_dir: /laravel
    entrypoint: npm run dev
    network_mode: "host"
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - '8081:80'
    environment:
      PMA_HOST: mysql_bpanel
      MYSQL_ROOT_PASSWORD: bttcr
      UPLOAD_LIMIT: 1G
      MAX_EXECUTION_TIME: 3600
    networks:
      red_local_bpanel:
  phpmyadmin_test:
    image: phpmyadmin/phpmyadmin
    ports:
      - '8082:80'
    environment:
      PMA_HOST: mysql_bpanel_test
      MYSQL_ROOT_PASSWORD: bttcr
    networks:
      red_local_bpanel_test:
  php_tools:
    build: .docker/php_tools
    volumes:
      - ./:/var/www/html/
      - /usr/local/bin/composer:/usr/local/bin/composer
    working_dir: /var/www/html/
    networks:
      red_local_bpanel:
  mailhog:
    image: mailhog/mailhog
    ports:
      - "8025:8025"
      - "1025:1025"
    networks:
      red_local_bpanel:
networks:
  red_local_bpanel:
  red_local_bpanel_test:
