Docker compose Laravel environment
Hisinhan / Sep 14 2021
12 mins read • 8,000 views
Build project
/*
docker-compose build
docker-compose up -d
*/
docker-compose up -d --build site
Create Laravel project
docker-compose run --rm composer create-project laravel/laravel .
config src/.env file
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
laravel environment is set. Now navigate to localhost... Voila
Enable mix hot
#.mix
.browserSync({
proxy: 'nginx',
open: false,
port: 3000,
});
docker-compose run --rm --service-ports npm run watch
Install React 1)
docker-compose run --rm composer require laravel/ui
docker-compose run --rm artisan ui react --auth
docker-compose run --rm npm install
npm run watch
docker-compose run --rm artisan migrate
Install React 2) via breeze
docker-compose run --rm composer require laravel/breeze --dev
docker-compose run --rm artisan breeze install
docker-compose run --rm artisan breeze:install react
docker-compose run --rm npm run install
docker-compose run --rm npm run dev
docker-compose run --rm artisan migrate
Install livewire
docker-compose run --rm composer require livewire/livewire
docker-compose run --rm artisan make:livewire hello-world
# add script roesources/views/welcome
@livewireStyles
</head>
<body>
@livewire('hello-world')
@livewireScripts
</body>
*************
Use of composer, artisan
docker-compose run --rm composer update
docker-compose run --rm npm run dev
docker-compose run --rm artisan migrate