Sail npm run dev

212 Views Asked by At

I'm new to Laravel, My application is Laravel, Vue + InertiaJS. I start my docker in terminal with

sail up -d

This will start the docker container, then I navigate to the url of my application, when I type in the terminal

sail npm run dev

that supposedly run the the backend and frontend of my app, but if I check in the browser it only shows me white empty page. but when I execute the command

sail npm run build

it will start to build the app, in this way, the app will work fine,

my problem is everytime I make changes I have to do the sail npm run build, and it consumes a lot of time in building the project, is there anyway can fix this?. That I only execute command sail npm run dev, and it should be working just like sail npm run build and no need for me to build again if I change something in the code

docker.compose.yml

build:
        context: ./vendor/laravel/sail/runtimes/8.2
        dockerfile: Dockerfile
        args:
            WWWGROUP: '${WWWGROUP}'
    image: sail-8.2/app
    extra_hosts:
        - 'host.docker.internal:host-gateway'
    ports:
        - '${APP_PORT:-80}:80'
        - '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
    environment:
        WWWUSER: '${WWWUSER}'
        LARAVEL_SAIL: 1
        XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
        XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        IGNITION_LOCAL_SITES_PATH: '${PWD}'
    volumes:
        - '.:/var/www/html'
        - './library/petcheckr-library/resources/js:/var/www/html/resources/js/Petcheckr'
        - './library/xocdr-library/resources/js:/var/www/html/resources/js/Xocdr'
        - './storage/app/public:/var/www/html/public/storage'
    networks:
        - petcheckr
    depends_on:
        - mariadb
        - redis
        - mailpit
mariadb:
    image: 'mariadb:10'
    ports:
        - '${FORWARD_DB_PORT:-3306}:3306'
    environment:
        MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
        MYSQL_ROOT_HOST: '%'
        MYSQL_DATABASE: '${DB_DATABASE}'
        MYSQL_USER: '${DB_USERNAME}'
        MYSQL_PASSWORD: '${DB_PASSWORD}'
        MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    volumes:
        - 'sail-mariadb:/var/lib/mysql'
        - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
    networks:
0

There are 0 best solutions below