services:
  # PHP & Laravel Application
  app:
    container_name: laravel_winary_app
    restart: unless-stopped
    working_dir: /var/www
    volumes:
      - ./:/var/www
      - .env.prod:/var/www/.env
    depends_on:
      - mysql
    networks:
      - winary_network
      - routing_net
    env_file:
      - .env.prod
    build:
      context: .
      dockerfile: Dockerfile.app

  # MySQL Service
  mysql:
    image: mysql:8.0
    container_name: laravel_winary_mysql
    restart: unless-stopped
    env_file:
      - .env.prod
    environment:
      SERVICE_NAME: mysql
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - winary_network
      
  # phpMyAdmin Service
  # phpmyadmin:
  #   image: phpmyadmin/phpmyadmin
  #   container_name: laravel_winary_phpmyadmin
  #   restart: unless-stopped
  #   environment:
  #     PMA_HOST: mysql
  #     PMA_PORT: 3306
  #     PMA_USER: root
  #     PMA_PASSWORD: ${DB_ROOT_PASSWORD}
  #   depends_on:
  #     - mysql
  #   networks:
  #     - winary_network

# Volumes
volumes:
  mysql_data:
    driver: local

# Networks
networks:
  winary_network:
    driver: bridge
  routing_net:
    driver: bridge
    external: true
