m1n64 / laravel-12-docker-startup
The skeleton application for the Laravel framework.
Installs: 62
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 7
Open Issues: 2
Type:project
pkg:composer/m1n64/laravel-12-docker-startup
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 .envfile 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 | 
| Run Tests | docker-compose exec -u www-data app php artisan test | make test | 
๐ 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.
๐ก PHPStorm Setup
PHP Interpreter
If you use Laravel IDEA
XDebug
๐งช Run Tests
make test
or,
docker-compose exec -u www-data app php artisan test
๐ 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! ๐