services:
    micro-i-portal:
        image: fermattech/iportal:latest
        container_name: micro-i-portal
        env_file:
            - ./.env
        restart: unless-stopped
        working_dir: /var/www
        networks:
            - i-portal-net
        volumes:
            - app-data:/var/www
            - public-data:/var/www/public
        command: sh -c 'chmod -R 777 /var/www/storage && php artisan key:generate && php-fpm'
        depends_on:
          - nginx
          - mysql
          - phpmyadmin
    nginx:
        image: nginx:alpine
        container_name: nginx-container
        restart: unless-stopped
        ports:
            - "80:80"
        volumes:
            - ./nginx.conf:/etc/nginx/conf.d/default.conf
            - app-data:/var/www
            - public-data:/var/www/public
        networks:
            - i-portal-net
    mysql:
        platform: linux/x86_64
        image: mysql:5.7
        container_name: mysql-i-portal
        restart: unless-stopped
        environment:
            MYSQL_DATABASE: rlv_local
            MYSQL_ROOT_PASSWORD: iportalX123@
            MYSQL_PASSWORD: root
            MYSQL_USER: user
        volumes:
            - mysql-data:/var/lib/mysql
        ports:
            - "3306:3306"
        expose:
            - "3306"
        networks:
            - i-portal-net
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpmyadmin
        restart: unless-stopped
        environment:
            PMA_HOST: mysql-i-portal
            PMA_PORT: 3306
            PMA_ARBITRARY: 1
            UPLOAD_LIMIT: 300M
            MYSQL_ROOT_PASSWORD: iportalX123@
        ports:
            - "8081:80"
        networks:
            - i-portal-net

networks:
    i-portal-net:
        driver: bridge

volumes:
    app-data:
    mysql-data:
    public-data: