Skip to content

Instantly share code, notes, and snippets.

@wildonion
Last active May 11, 2023 16:30
Show Gist options
  • Save wildonion/44959ad12968fe0acd0369c301fa859a to your computer and use it in GitHub Desktop.
Save wildonion/44959ad12968fe0acd0369c301fa859a to your computer and use it in GitHub Desktop.
Laravel Deployment using Sail

🎈 Usage

Install Docker then deploy the project as the following.

🚀 Deployment

install requirements.

sudo apt install composer && sudo apt install php-xml && composer update

add sail to the project.

composer require laravel/sail --dev

install sail to generate docker-compsoe.yml file, then edit it based on your needs.

php artisan sail:install

(re)build and run containers in docker-compose.yml file.

./vendor/bin/sail build --no-cache && ./vendor/bin/sail up -d

update the access inside the sail container, notice that the sail container name is <LARAVEL-DIR-NAME>-laravel.test-1.

sudo docker exec -it <LARAVEL-DIR-NAME>-laravel.test-1 bash

then inside the container run

chmod -R 777 . && chmod -R 777 storage/

generate key and migrate database.

./vendor/bin/sail artisan key:generate && ./vendor/bin/sail artisan migrate && ./vendor/bin/sail artisan schedule:run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment