-
Install Dependencies:
composer update
-
Install Dev Container: (Select only mysql)
php artisan sail:install --devcontainer
-
Install Extentions: Install the Remote - Containers and Docker and Dev Container extensions in VS Code.
-
Open VScode: Open Source Code in the project folder.
code . -
Reopen in Container: Press
F1, typeReopen in Container, and select it. VS Code will build the container and open your project inside it. -
Install Dependencies: Once inside the container, install the project dependencies.
composer install
-
Generate Key: Generate the Laravel application key.
php artisan key:generate
-
Run database.sql: Run the database.sql file to mysql.
mysql -h <mysql-host> -u root -p -D <database> < database.sql
-
Run Laravel Server: Once inside the container, run the Laravel development server.
php artisan serve --host=0.0.0.0 --port=8000
-
Access the Project: Open your browser and navigate to
http://localhost:8000to see your Laravel project running.
That's it! You now have your Laravel project running inside a development container.