m1n64 / laravel-12-docker-startup
The skeleton application for the Laravel framework.
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Type:project
Requires
- php: ^8.2
- dedoc/scramble: ^0.12.10
- laravel/framework: ^12.0
- laravel/horizon: ^5.30
- laravel/sanctum: ^4.0
- laravel/telescope: ^5.5
- laravel/tinker: ^2.10.1
- opcodesio/log-viewer: ^3.15
Requires (Dev)
- fakerphp/faker: ^1.23
- laravel/pail: ^1.2.2
- laravel/pint: ^1.13
- laravel/sail: ^1.41
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.6
- phpunit/phpunit: ^11.5.3
README
This is a Docker-based template for Laravel 12, built with:
- PHP 8.4 (FPM on Alpine)
- PostgreSQL 16
- Redis (Alpine)
- Node.js 22 + NPM
- Supervisor for Queue & Scheduler
- Makefile for easy commands (like Laravel Sail)
- Nginx
- Composer
- XDebug in Dev Mode
And useful libraries:
🛠 Setup Instructions
1️⃣ Clone the Repository
composer create-project m1n64/laravel-12-docker-startup laravel-12-docker
cd laravel-12-docker
2️⃣ Copy .env
and Update Configuration
cp .env.example .env
- Open
.env
file and change it:
DB_DATABASE=<your-db> # Change DB name
-
Change the container name prefix:
Inside
docker-compose.yml
, renamel12-
to your project name:
services: app: container_name: myproject-app nginx: container_name: myproject-nginx postgres: container_name: myproject-postgres redis: container_name: myproject-redis
-
Change the Docker network
In
docker-compose.yml
:
networks: myproject-network:
🚀 Start Containers
🔹 Using Docker
docker-compose up -d
🔹 Using Makefile
make up # For development make prod # For production
📦 Install Dependencies
🛠 Install PHP Dependencies
Run inside the container:
docker-compose exec -u www-data app composer install
Or using Makefile:
make composer install
🎸 Install Node.js & NPM Dependencies
make npm install
make npm run dev # Run Vite for development
🔑 Generate App Key
make artisan key:generate
📜 Run Migrations
make artisan migrate
🔗 Create Storage Symlink
make artisan storage:link
💻 Available Commands
🛠 Running Laravel Commands
Action | Docker Command | Makefile Shortcut |
---|---|---|
Run php artisan |
docker-compose exec -u www-data app php artisan <cmd> |
make artisan <cmd> |
Run composer |
docker-compose exec -u www-data app composer <cmd> |
make composer <cmd> |
Run npm |
docker-compose exec -u www-data app npm <cmd> |
make npm <cmd> |
Open Bash | docker-compose exec -u www-data app bash |
make bash |
View Logs | docker-compose logs -f app |
make logs app |
Open PostgreSQL CLI | docker-compose exec -e PGPASSWORD=<pass> postgres psql -U <user> -d <db> |
make psql |
Open Redis CLI | docker-compose exec redis redis-cli |
make redis |
🛑 Managing Containers
🔄 Restart & Stop
Action | Docker Command | Makefile Shortcut |
---|---|---|
Restart all | docker-compose restart |
make restart |
Restart one | docker-compose restart <service> |
make restart-container CONTAINER=<name> |
Stop all | docker-compose stop |
make stop |
Stop one | docker-compose stop <service> |
make stop-container CONTAINER=<name> |
Start all | docker-compose up -d |
make up |
Remove all | docker-compose down -v |
make down |
For list of all makefile commands, run make help
.
📜 Additional Notes
- This setup supports Laravel Queues & Scheduler via Supervisor.
- PostgreSQL, Redis & Supervisor are configured out of the box.
- Uses Node.js 22 for Vite & frontend dependencies.
- All Docker volumes persist data between container restarts.
🔥 Now your Laravel 12 project is fully containerized!
Use Makefile commands just like Laravel Sail, and enjoy seamless Docker development! 🚀