Skip to content

Instantly share code, notes, and snippets.

@ZachWatkins
Last active February 9, 2023 04:24
Show Gist options
  • Save ZachWatkins/dacb4b5aab5c4eb05f6154eb98b8096b to your computer and use it in GitHub Desktop.
Save ZachWatkins/dacb4b5aab5c4eb05f6154eb98b8096b to your computer and use it in GitHub Desktop.
New Laravel and Vue App

Installing on Windows

Open a new Windows Subsystem for Linux session.

$ wsl

Create a new Laravel application. This will take a while so go do something else and come back in about 10 minutes.

$ curl -s "https://laravel.build/laravel-vue-docker?with=mysql,redis,mailpit&devcontainer" | bash

Change directories.

$ cd laravel-vue-docker

Open the directory in Visual Studio Code.

$ code .

Then install the recommended Visual Studio Code extensions, particularly Remote Development and Docker. For now, ignore the prompt about opening the workspace in a devcontainer.

Open http://localhost in your web browser. This is being served from the /public directory.

Set your Node version if necessary. Sail installs Node 18 by default. To change the Node version that is installed when building your images, you may update the build.args definition of the laravel.test service in your application's docker-compose.yml file:

build:
    args:
        WWWGROUP: '${WWWGROUP}'
        NODE_VERSION: '16'

After updating your application's docker-compose.yml file, you should rebuild your container images:

$ ./vendor/bin/sail build --no-cache 
$ ./vendor/bin/sail up

View available commands for Laravel Sail.

$ ./vendor/bin/sail help

Alias the Sail command if you plan on using it a lot and know how to add it to your bash profile in WSL.

$ alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment