This repository provides a fast and efficient solution for setting up a Laravel development environment using Docker. The goal is to automate the entire container creation and configuration process, allowing you to get started with your Laravel project without worrying about manual environment setup.
Watch the following video to see the full process of setting up the project:
- Automated Docker setup for PHP, Nginx, MySQL, and Redis.
- Self-signed SSL certificates for local development.
- Queue configuration with
php artisan queue:work
. - Easy to customize and adapt for other Laravel projects.
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
To get started with this project, follow these steps:
-
Clone this repository:
git clone https://github.com/wallacemartinss/laravel-docker-automated-setup cd docker-laravel-automated-setup
-
Copy the .env.example file to .env
cp .env.example .env
-
Open the .env file and configure the following variables:
APP_NAME="your Application name" DB_DATABASE=your_database_name DB_USERNAME=your_database_username DB_PASSWORD=your_database_password
-
Give execution permission to the start.sh script:
chmod +x start.sh
-
Run the start.sh script to bring up the containers and laravel:
./start.sh
-
To start developing the application, access the app container with the following command:
docker compose exec app bash
app: PHP-FPM with Laravel nginx: Web server (with SSL enabled) mysql: MySQL database redis: Redis caching service mailpit: Local mail server for development
You can easily customize the Docker and Nginx configuration to fit your needs. Here's what you can modify:
Dockerfile: Modify to install additional PHP extensions or tools. nginx/default.conf: Adjust server settings and routes. .env: Change environment variables for your Laravel project (e.g., database credentials, Redis settings).
Feel free to contribute by submitting issues or pull requests. If you have suggestions or improvements, they are always welcome!