Multi-stage Dockerfile: the dev stage mounts code from the host, while the prod stage bakes the code and an optimized autoloader into the image and runs as www-data
laravel-docker-starter — Laravel Starter Template
By Mominde92
A Docker Compose-based Laravel runtime environment template that includes Nginx, PHP-FPM 8.4, and MySQL 8.4, providing development and production image stages and common Make commands.
Explore the design
Compare the page layouts and mobile experience. Open any screenshot for a closer look.
Actual screenshot captured by the server browser.
All pages & views 3
Screenshots show visual appearance; interactive behavior may differ.
What stands out
A quick read of the recorded project description.
docker-compose.yml defines app (PHP-FPM), web (Nginx), and db (MySQL with a health check, ensuring PHP starts only after the database is ready)
Nginx configuration serves only the public/ directory, forwards PHP requests to PHP-FPM, and hides dotfiles such as .env and .git
Provides Makefile shortcuts: up, down, shell, migrate, test, logs, perms, prod-image, and more
The README notes that CI verifies the homepage returns 200, /.env is blocked, and the production image can be built
Template Details
This template targets Laravel projects and provides a reusable Docker Compose configuration. The README states that it includes a multi-stage Dockerfile (the dev stage mounts local code, while the prod stage bakes the code and an optimized autoloader into the image and runs as www-data), docker-compose.yml (app as PHP-FPM, web as Nginx, db as MySQL with a health check so PHP starts only after the database is ready), Nginx configuration (serves only public/, forwards PHP requests to FPM, and hides dotfiles such as .env and .git), OPcache configuration, and a Makefile.
Usage is to copy the Dockerfile, docker-compose.yml, .dockerignore, Makefile, and the docker/ directory into an existing Laravel project, configure the database connection in .env, then run make install to complete the build, startup, composer install, key:generate, and migrate, and visit http://localhost:8080. The README also lists the equivalent docker compose commands when not using make.
The README mentions that CI creates a fresh Laravel application on every push, starts the stack, runs migrations, and verifies that the homepage returns 200 through Nginx, that /.env is blocked, and that the production image can be built. The README does not provide information about this template for other frameworks, cache drivers, queues, scheduled tasks, or HTTPS termination.
Is it right for your project?
Use Cases
- Add a unified local Docker development environment to an existing Laravel project
- Reproduce the same Nginx + PHP-FPM + MySQL runtime environment across team machines and servers
- Build a production image for deployment via make prod-image
- Start the stack in CI and run migrations and homepage accessibility checks
Suitable For
- Developers using Laravel who want to manage their local development environment via Docker Compose
- Teams that need a Nginx + PHP-FPM + MySQL combination and want a production image build step
- Users willing to copy the template files into an existing Laravel project per the README and manually configure .env
Getting started & customization
Use these recorded setup notes alongside the repository instructions for your chosen version.
- 1
Copy the Dockerfile, docker-compose.yml, .dockerignore, Makefile, and the docker/ directory into the Laravel project
- 2
Set DB_CONNECTION=mysql, DB_HOST=db, DB_PORT=3306, DB_DATABASE, DB_USERNAME, and DB_PASSWORD in .env
- 3
Run make install to complete the build, startup, composer install, key:generate, and migrate, then visit http://localhost:8080
- 4
DB_HOST must not be 127.0.0.1; use the service name db instead; DB_USERNAME must not be root; for storage/ permission issues, run make perms; for port conflicts, set APP_PORT
- 5
For production deployment, the README recommends building the image in CI and deploying a tagged version, avoiding writing secrets into the image, running config:cache route:cache view:cache at startup, not publishing the MySQL port, and backing up the dbdata volume
License & source material
Usage conditions & limitations
Free to use · keep license noticeThis entry covers the free version under the MIT license in the public repository; the free scope is the code of this version and does not mean that external services or third-party assets are free.
Must comply with when using
- Free use, modification, commercial use, and distribution of this version's code are permitted.
- When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
- The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.
Additional costs & items to verify
- Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
- External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis
https://github.com/Mominde92/laravel-docker-starter/blob/main/LICENSEhttps://github.com/Mominde92/laravel-docker-starter/blob/main/README.mdPermission is hereby granted, free of charge
Original License Text
Compiled by DeepSeek based on repository license and README ·2026-10-14. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.
Project checks & description sources
Template Information
- Source platforms
- GitHub
- Documentation and maintenance reference score
- More documented · 80 / 100
- Technologies
- Laravel
- Website type
- Starter
How this score is calculated
Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.
What to verify for this project
- Repository update recorded
- 2026-10-14
- Screenshot last checked
- 2026-10-14
A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.
The catalog identifies Laravel as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.
Use a selection guide →How this description was prepared
AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.
Review declaration: codex-user-requested-batch-review-20261015 · 2026-10-15
Inspect the recorded source material
SHA-256: 52b64f2178b39d3a4954a4c15a0c776982f44493d5a6949da5bbe6c69bbb29a0
2026-10-14T12:55:10.710Z
Source file / repository# Laravel Docker Starter [](https://github.com/Mominde92/laravel-docker-starter/actions/workflows/ci.yml)     A small, production-minded Docker Compose setup for Laravel: **Nginx + PHP-FPM 8.4 + MySQL 8.4**. Drop it into any Laravel project and get the same environment on every laptop and server. Every push is tested in CI: a fresh Laravel app is created, the stack is started, migrations run, the home page must answer `200` through Nginx, `/.env` must be blocked, and the production image must build. ## What you get | File | Purpose | |---|---| | `Dockerfile` | Multi-stage image: `dev` (code mounted from your machine) and `prod` (code + optimized autoloader baked in, runs as `www-data`). | | `docker-compose.yml` | `app` (PHP-FPM), `web` (Nginx) and `db` (MySQL with a healthcheck, so PHP starts only when the database is ready). | | `docker/nginx/default.conf` | Serves `public/` only, passes PHP to FPM, hides dot-files such as `.env` and `.git`. | | `docker/php/opcache.ini` | OPcache tuned for production images. | | `Makefile` | Short commands for daily work. | ## Quick start Copy `Dockerfile`, `docker-compose.yml`, `.dockerignore`, `Makefile` and the `docker/` folder into your Laravel project, then set the database in `.env`: ```env DB_CONNECTION=mysql DB_HOST=db DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=laravel DB_PASSWORD=secret ``` ```bash make install # build, start, composer install, key:generate, migrate ``` Open http://localhost:8080. Without `make`: ```bash docker compose up -d --build --wait docker compose exec app composer install docker compose exec app chown -R www-data:www-data storage bootstrap/cache docker compose exec app php artisan key:generate docker compose exec app php artisan migrate ``` ## Daily commands ```bash make up # start make down # stop make shell # shell inside the PHP container make migrate # run migrations make test # php artisan test make logs # follow logs ``` ## Things that trip people up - **`DB_HOST=127.0.0.1` does not work.** Inside a container that address is the container itself. Use the service name `db`. - **`DB_USERNAME` cannot be `root`.** The MySQL image creates `DB_USERNAME` as a normal user; the root password is `DB_ROOT_PASSWORD`. - **"Permission denied" in `storage/`.** PHP-FPM runs as `www-data`; run `make perms` once. - **Port 8080 is taken.** Set `APP_PORT=8081` in `.env`. ## Production ```bash make prod-image # docker build --target prod -t laravel-app:prod . ``` The `prod` stage installs dependencies without dev packages, copies the code into the image, optimizes the autoloader and drops root. For a real deployment also: - build the image in CI and deploy a tagged version, so servers run exactly what was tested; - keep secrets out of the image (environment variables or Docker secrets, never a committed `.env`); - run `php artisan config:cache route:cache view:cache` on start; - do not publish the MySQL port, and back up the `dbdata` volume. A step-by-step explanation of this setup is on my blog: [Dockerizing a Laravel app with Docker Compose](https://moumen-dev.com/blog/docker-compose-laravel/). ## Author **Moamen Derine**, Senior Full Stack Developer & DevOps Engineer in Dubai. [moumen-dev.com](https://moumen-dev.com) · [LinkedIn](https://www.linkedin.com/in/momin-derine/) ## License [MIT](LICENSE)
Explore similar templates
Compare previews and descriptions within the same stack and category.

sage
Sage is a WordPress starter theme maintained by Roots, using Laravel Blade components and templates, Vite builds, Tailwind CSS, and built-in block editor support.
Laravel · Starter

wave
Wave is an open-source SaaS starter kit built on Laravel and released under the MIT license.
Laravel · SaaS

filament-starter
A Laravel TALL stack starter template maintained by Log1x, with a preconfigured Filament admin panel and plugins including Curator, Gravatar, Exceptions, Jobs Monitor, Breezy, Peek, and Logger.
Laravel · Starter

electrik
Electrik is a Laravel SaaS starter kit installed as a Composer package, with authentication, teams, Stripe subscription billing, and the Slate 3 interface under the Electrik\ namespace rather than copied into App\.
Laravel · SaaS

php-saas
php-saas is a Laravel-based SaaS starter positioned as an everything-included kit. It generates new projects via a global Composer command and includes authentication with two-factor, API tokens, Stripe and Paddle billing, and project, team, and organization management.
Laravel · SaaS

filament-jetstream
A Laravel starter kit that implements Jetstream-like authentication and account features using Filament's native panels and components. It includes login, registration, two-factor authentication, session management, user profiles, and optional teams and API tokens.
Laravel · Starter
