services:
    micro-e-lica:
        image: fermattech/elica:latest
        container_name: micro-e-lica
        env_file:
            - ./.env
        restart: unless-stopped
        working_dir: /var/www
        networks:
            - e-lica-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:
            - e-lica-net
    mysql:
        platform: linux/x86_64
        image: mysql:5.7
        container_name: mysql-e-lica
        restart: unless-stopped
        environment:
            MYSQL_DATABASE: rlv_local
            MYSQL_ROOT_PASSWORD: elicaX123@
            MYSQL_PASSWORD: root
            MYSQL_USER: user
        volumes:
            - mysql-data:/var/lib/mysql
        ports:
            - "3306:3306"
        expose:
            - "3306"
        networks:
            - e-lica-net
    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpmyadmin
        restart: unless-stopped
        environment:
            PMA_HOST: mysql-e-lica
            PMA_PORT: 3306
            PMA_ARBITRARY: 1
            UPLOAD_LIMIT: 300M
            MYSQL_ROOT_PASSWORD: elicaX123@
        ports:
            - "8081:80"
        networks:
            - e-lica-net

networks:
    e-lica-net:
        driver: bridge

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