Just a docker-compose file for the easiest Laravel application deployment with PHP, MySQL and NGINX (LEMP) stack. From git hosting to your production machine under Docker environment. Optimized for Laravel production environment.
This document is also available in another languages, please visit the readmes folder.
- Deploy Laravel app from git hosting or local folder automatically.
- Support multi database.
- support various PHP version. click this link to see all available PHP version.
- Clone from private git repository.
- Expose container's IP to public.
Any suggestion? open new issue!.
Make sure the Docker has been installed on your system. If the Docker is not installed yet, please visit this link for installation guide.
Also make sure the directory structure of your Laravel application is complies to the Laravel default structure.
- Clone or download this repository.
- Copy the
.env.example
and rename to.env
, fill all variables that you need for your Laravel application on production environment. All mandatory and optional variables has been described inside the file. - Run
docker-compose up -d
and wait until all containers has been started. - Done 🎉 your application has been served on your machine by now.
Demostration video (Bahasa Indonesia): https://youtu.be/W5Cng_NY2p0
As you can see, this repository have the .env.example
file for basic guide of create you .env
file.
The .env
file is used for both Laravel Docker Deployer and your Laravel App.
The list of .env
variables that used by Laravel Docker Deployer are shown on the table below:
Variable | Default | Description |
---|---|---|
PHP_VERSION | Mandatory. All available versions can be seen on: https://hub.docker.com/r/sensasidelight/php-laravel/tags |
|
MYSQL_VERSION | Mandatory. All available versions can be seen on: https://hub.docker.com/_/mysql/tags | |
NGINX_VERSION | Mandatory. All available versions can be seen on: https://hub.docker.com/_/nginx/tags | |
APP_SRC_GIT | Mandatory if you want to clone the project using git. APP_SRC_LOCAL variable if you want to using this. value examples: https://github.com/laravel/laravel, ../path/to/your/awesome/project/.git |
|
APP_SRC_GIT_BRANCH | Optional. | |
APP_SRC_LOCAL | Mandatory if you want to copy-paste the project from your local directory. APP_SRC_GIT variable if you want to using this. example: ../path/to/your/awesome/project
|
|
DB_ROOT_PASSWORD | Mandatory. | |
PORT | 80 | Optional. Binded port on docker host. |
SEED_DB | false | Optional. Seeding is only for testing. Your production environment shouldn't seed the database. faker/faker ) is required on composer.json , not on require-dev
|
DB_DATABASE* | forge | Optional. If your application use multiple database, just add new *_DB_DATABASE_* variable on the .env file. examples: SECOND_DB_DATABASE=forge_2 , DB_DATABASE_LOG=forge_log
|
DB_HOST* | mysql | Mandatory. Please don't change the value. |
DB_USERNAME* | Mandatory. root value |
|
DB_PASSWORD* | Mandatory. |
*: Also used by by Laravel
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project.
- Create your Feature Branch (
git checkout -b AmazingFeature
). - Commit your Changes (
git commit -m 'Add some AmazingFeature'
). - Push to the Branch (
git push origin AmazingFeature
). - Open a Pull Request.
The code is released under the MIT license.
📧 e-mail - zainadam.id@gmail.com
🐦 Twitter: @SENSASI_delight