'docker-compose + symfony in windows env

i've installed docker (windows 10) with wsl2 (ubuntu distro) and added my docker-compose.yml

version: '3'
services:
    web:
        image: nginx:1.20.1
        container_name: web
        restart: always
        ports:
            - "80:80"
        volumes:
            - ./nginx.d.conf:/etc/nginx/conf.d/nginx.conf
            - ./nginx.conf:/etc/nginx/nginx.conf            
            - ./www/my-app:/app
    php:
        build:
            context: .
            dockerfile: myphp.dockerFile
        container_name: php
        restart: always
        depends_on:
            - web
        volumes:
            - ./www/my-app:/app
    mysql:
        image: mariadb:10.3.28
        container_name: mysql
        restart: always
        depends_on:
            - php
        environment:
            MYSQL_ROOT_PASSWORD: '******'
            MYSQL_USER: 'root'
            MYSQL_PASSWORD: '******'
            MYSQL_DATABASE: 'my-database'
        command: ["--default-authentication-plugin=mysql_native_password"]
        volumes:
            - mysqldata:/var/lib/mysql
            - ./my.cnf:/etc/mysql/my.cnf
        ports:
            - 3306:3306
    cache:
        image: redis:5.0.3
        container_name: cache
        restart: always
        ports:
            - 6379:6379
        networks:
            - my-network
        volumes:
            - ./cache:/cache

volumes:
    mysqldata: {}

networks:
    my-network:
        driver: "bridge"    

So my symfony code is in the /www/my-app window's folder. This includes the /www/my-app/vendor too.

My application is running extremely slow (50-70 seconds). If i'm correct it's because the vendor folder is huge (80MB) and docker creates an image of it every time. Other discussions mentioned that vendor folder sould be moved into a new volume, and here i'm stuck with it. How to move and mount that in this case, and how should the docker-compose.yml look like after it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source