Docker Compose 编排 PHP-FPM、Nginx、MySQL、Redis、MailHog 等服务
laravel-dockerized-starter — Laravel 启动器模板
作者 tanjir-mahabub
基于 Laravel 的 Docker 化起步模板,集成 Nginx、MySQL、Redis、MailHog 等开发服务,并提供 Render 部署配置与 GitHub Actions 工作流。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
提供 docker-compose.dev.yml 与 docker-compose.prod.yml 区分开发与生产配置
本地开发附带 phpMyAdmin、Redis Commander、MailHog 三个辅助界面
包含 Dockerfile 与 render.yaml,用于在 Render 上部署
提供 GitHub Actions 工作流,可基于 RENDER_SERVICE_ID 和 RENDER_API_KEY 自动部署
README 列出数据库迁移、缓存清理、容器内执行 artisan 与 composer 等常用命令
模板详细介绍
这是一个 Laravel 起步模板,核心目的是把本地开发环境与部署配置一起打包进 Docker。README 说明它包含 PHP 8.4、Nginx、MySQL 8.0、Redis 和 MailHog 的完整 Docker 配置,并提供 phpMyAdmin、Redis Commander 等本地开发辅助工具。项目结构上区分了 docker-compose.yml、docker-compose.dev.yml 与 docker-compose.prod.yml,Dockerfile 用于生产镜像,render.yaml 用于 Render 部署,.github 下存放 GitHub Actions 工作流。
使用流程在 README 中有明确步骤:克隆仓库后执行 docker-compose up -d 启动服务,进入 app 容器执行 composer install、php artisan key:generate 和 php artisan migrate,然后通过 localhost 访问应用,phpMyAdmin、Redis Commander、MailHog 分别监听 8080、8081、8025 端口。部署方面,README 给出 Render 的连接仓库、设置数据库与 APP_KEY 等环境变量、由 Dockerfile 和 render.yaml 自动部署的流程,也提到可用 GitHub Actions 配合 RENDER_SERVICE_ID 与 RENDER_API_KEY 两个密钥完成自动化部署。
README 未说明模板内置的具体业务功能、测试覆盖情况、PHP 扩展之外的运行时调优,也未提供性能或生产环境验证结果;这些方面需要使用者自行评估。
适合你的项目吗?
适用场景
- 需要把 Laravel 本地开发环境统一到 Docker 的团队或个人项目
- 希望以容器方式在 Render 上部署 Laravel 应用并接入 GitHub Actions 的场景
- 本地开发中需要同时使用 MySQL、Redis 与邮件测试工具的 Laravel 项目
- 需要一份可参照的 Docker 目录结构与 Nginx、PHP 配置示例的起步工程
适合人群
- 熟悉 Docker 与 Docker Compose 基本操作的 Laravel 开发者
- 需要容器化开发环境与部署配置模板的新项目
- 使用 Render 作为部署平台并希望接入 CI/CD 的团队
- 需要在本地调试数据库与 Redis 的开发者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
前置条件为 Docker、Docker Compose 与 Git。
- 2
克隆仓库后执行 docker-compose up -d 或 docker-compose -f docker-compose.dev.yml up -d 启动服务。
- 3
进入 app 容器执行 composer install、php artisan key:generate 与 php artisan migrate。
- 4
本地访问地址为 http://localhost,phpMyAdmin 为 8080,Redis Commander 为 8081,MailHog 为 8025。
- 5
Render 部署需在控制台设置 DB_HOST、DB_DATABASE、DB_USERNAME、DB_PASSWORD、DB_PORT 与 APP_KEY;GitHub Actions 方式需配置 RENDER_SERVICE_ID 与 RENDER_API_KEY。
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 部署到 Render 需要将 GitHub 仓库连接到 Render 平台,即依赖 Render 这一外部服务。
- 在 Render 部署时需要在 Render 控制台手动设置数据库连接与 APP_KEY 等环境变量。
- 使用 GitHub Actions 自动部署需要配置仓库密钥。
- GitHub Actions 自动部署需要提供 Render 服务 ID(RENDER_SERVICE_ID)。
- GitHub Actions 自动部署需要提供 Render API 密钥(RENDER_API_KEY)。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
1. **Connect Repository**: Link your GitHub repository to Render
README 原文
2. **Environment Variables**: Set the following in Render dashboard:
README 原文
The template includes a GitHub Actions workflow for automated deployment. Set these secrets:
README 原文
- `RENDER_SERVICE_ID`: Your Render service ID
README 原文
https://github.com/tanjir-mahabub/laravel-dockerized-starter/blob/main/LICENSEhttps://github.com/tanjir-mahabub/laravel-dockerized-starter/blob/main/README.md- `RENDER_API_KEY`: Your Render API key
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-13。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 74 / 100
- 技术栈
- Laravel
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2025-06-29
- 截图检查日期
- 2026-10-13
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Laravel。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: codex-user-requested-batch-review-20261015 · 2026-10-15
查看当时使用的来源资料
SHA-256: 8675f9651dc179b4cce59498e7d34ca40fe2764576017883cccb399119f34ad1
2026-10-13T19:42:51.754Z
来源文件 / 仓库# 🚀 Laravel Dockerized Starter Template A production-ready Laravel starter template with Docker, Nginx, MySQL, Redis, and automated deployment to Render. ## ✨ Features - **🐳 Dockerized Development**: Complete Docker setup with PHP 8.4, Nginx, MySQL 8.0, Redis, and MailHog - **🚀 Production Ready**: Optimized for deployment on Render with single-container setup - **🔧 Development Tools**: Includes phpMyAdmin, Redis Commander, and MailHog for local development - **⚡ CI/CD Ready**: GitHub Actions workflow for automated deployment - **🔒 Security**: Proper environment variable handling and security headers - **📱 Modern Stack**: Laravel 11, PHP 8.4, MySQL 8.0, Redis 7 ## 🚀 Quick Start ### Prerequisites - Docker and Docker Compose - Git ### 1. Create New Project ```bash # Use this template to create a new repository # Then clone your new repository git clone <your-repo-url> cd <your-project-name> ``` ### 2. Start Development Environment ```bash # Start all services docker-compose up -d # Or use the development configuration docker-compose -f docker-compose.dev.yml up -d ``` ### 3. Install Laravel Dependencies ```bash # Enter the PHP container docker-compose exec app bash # Install dependencies composer install # Generate application key php artisan key:generate # Run migrations php artisan migrate # Exit container exit ``` ### 4. Access Your Application - **Laravel App**: http://localhost - **phpMyAdmin**: http://localhost:8080 - **Redis Commander**: http://localhost:8081 - **MailHog**: http://localhost:8025 ## 🏗️ Project Structure ``` laravel-dockerized-starter/ ├── docker/ # Docker configurations │ ├── mysql/ # MySQL configuration │ ├── nginx/ # Nginx configuration │ └── php/ # PHP configuration ├── src/ # Laravel application ├── docker-compose.yml # Main Docker Compose ├── docker-compose.dev.yml # Development configuration ├── docker-compose.prod.yml # Production configuration ├── Dockerfile # Production Dockerfile ├── render.yaml # Render deployment config └── .github/ # GitHub Actions workflows ``` ## 🐳 Docker Services | Service | Port | Description | | ------------------- | --------- | ------------------- | | **app** | 9000 | PHP-FPM Application | | **nginx** | 80 | Web Server | | **mysql** | 3306 | Database | | **redis** | 6379 | Cache/Session Store | | **mailhog** | 1025/8025 | Email Testing | | **phpmyadmin** | 8080 | Database Management | | **redis-commander** | 8081 | Redis Management | ## 🚀 Deployment ### Render Deployment 1. **Connect Repository**: Link your GitHub repository to Render 2. **Environment Variables**: Set the following in Render dashboard: ``` DB_HOST=your-mysql-host DB_DATABASE=your-database-name DB_USERNAME=your-username DB_PASSWORD=your-password DB_PORT=3306 APP_KEY=base64:your-generated-key ``` 3. **Deploy**: Render will automatically deploy using the `Dockerfile` and `render.yaml` ### GitHub Actions (Alternative) The template includes a GitHub Actions workflow for automated deployment. Set these secrets: - `RENDER_SERVICE_ID`: Your Render service ID - `RENDER_API_KEY`: Your Render API key ## 🔧 Configuration ### Environment Variables Create `.env` files for different environments: #### Local Development ```bash # Copy example file cp src/.env.example src/.env # Update with local settings DB_CONNECTION=mysql DB_HOST=mysql DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=laravel_user DB_PASSWORD=laravel_password ``` #### Production Set these in your deployment platform (Render): ```bash APP_ENV=production APP_DEBUG=false DB_HOST=your-production-host DB_DATABASE=your-production-database DB_USERNAME=your-production-username DB_PASSWORD=your-production-password ``` ### Database Setup ```bash # Run migrations docker-compose exec app php artisan migrate # Seed database (if seeders exist) docker-compose exec app php artisan db:seed # Create a new migration docker-compose exec app php artisan make:migration create_example_table ``` ## 🛠️ Development Commands ```bash # Start services docker-compose up -d # Stop services docker-compose down # View logs docker-compose logs -f # Execute commands in container docker-compose exec app php artisan list docker-compose exec app composer install docker-compose exec app npm install # Access database docker-compose exec mysql mysql -u laravel_user -p laravel # Clear caches docker-compose exec app php artisan cache:clear docker-compose exec app php artisan config:clear docker-compose exec app php artisan route:clear ``` ## 🔒 Security - Environment variables are properly handled - Sensitive files are protected by Nginx - Security headers are configured - Database credentials are externalized ## 📝 Customization ### Adding New Services 1. Add service to `docker-compose.yml` 2. Update `docker-compose.dev.yml` if needed 3. Add any necessary configuration files ### Modifying PHP Extensions Edit `docker/php/Dockerfile` to add/remove PHP extensions: ```dockerfile RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd ``` ### Custom Nginx Configuration Modify `docker/nginx/conf.d/app.conf` for custom routing or headers. ## 🐛 Troubleshooting ### Common Issues 1. **Port conflicts**: Change ports in `docker-compose.yml` 2. **Permission issues**: Run `chmod -R 755 src/storage src/bootstrap/cache` 3. **Database connection**: Check environment variables and MySQL service status 4. **Nginx errors**: Check logs with `docker-compose logs nginx` ### Logs ```bash # View all logs docker-compose logs # View specific service logs docker-compose logs app docker-compose logs nginx docker-compose logs mysql ``` ## 🤝 Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Test thoroughly 5. Submit a pull request ## 📄 License This project is open-sourced software licensed under the [MIT license](LICENSE). ## 🙏 Acknowledgments - [Laravel](https://laravel.com/) - The PHP framework - [Docker](https://www.docker.com/) - Containerization platform - [Render](https://render.com/) - Cloud deployment platform --- **Happy Coding! 🎉**
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

sage
WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and block editor support
Laravel · 启动器

wave
Wave - The Software as a Service Starter Kit, designed to help you build the SAAS of your dreams 🚀 💰
Laravel · SaaS

filament-starter
A beautiful starting point for your next TALL stack project using Filament. ⚡
Laravel · 启动器

electrik
Laravel SaaS starter kit: auth, teams, Stripe billing, and Slate 3 — Composer package for Laravel 12
Laravel · SaaS

php-saas
The everything-included starter kit for your next idea
Laravel · SaaS

filament-jetstream
A Laravel starter kit built with Filament inspired by Jetstream.
Laravel · 启动器
