The source code for docker-for-laravel.com
I have a laravel application, I want to dockerize my app and deploy on production. I have some questions like
- What is the best way to create an optimal image for Laravel App.
- Should I have
nginx
andphp
in the same docker image. - Should I have different containers running for
web
,scheduler
,queues
, etc. - What is the best strategy to plan dockerization of app?
The following tools are required in order to start the installation.
- PHP 8.3
- composer
- npm
- Clone this repository
git clone git@github.com:codeat3/docker-for-laravel.com.git
- Copy
.env.example
file to '.env` - Install the PHP dependencies with
composer install
- Generate a new app key with
php artisan key:generate
- Install and compile the front-end dependencies with
npm install && npm run dev
- Serve the website locally by running
php artisan serve
You can now visit the app in your browser by visiting http://127.0.0.1:8000.
If you have any good resources which can help a laravel developer get the dockerized setup on production. Create a PR and add the resource to app/Models/DockerResource.php
.
The format of the resource should be as follows
[
'id' => 4,
'author' => 'Author Name',
'social_handle' => 'social handle link',
'title' => 'title of the resource',
'link' => 'link of the resource'
],