Understand the project structure and environments
mainThe project uses a modular directory structure to separate shared configurations from environment-specific ones.
Directory Layout
app/: The standard Laravel application directory.docker/common/: Shared Docker configurations used by both environments.docker/development/: Configurations specific to the development workflow (e.g., Xdebug, volume mounts).docker/production/: Configurations optimized for production (e.g., minimal images, security hardening).compose.dev.yaml: The Docker Compose file for the development environment.compose.prod.yaml: The Docker Compose file for the production environment.
Environment Comparison
| Feature | Development (compose.dev.yaml) | Production (compose.prod.yaml) |
|---|---|---|
| Goal | Developer productivity and debugging | Performance, security, and stability |
| Tools | Includes Xdebug, Node.js (via NVM), and NPM | |
| Code Updates | Hot reloading via volume mounts | |
| Build Strategy | Extends production builds with dev tools | |
| Optimization | Focus on tool availability | |
| Security | Writable permissions for volumes | |
| Assets | Compiled via npm run dev | |
| Assets | Pre-built during the build process | |
| Services | PHP-FPM, Nginx, Redis, PostgreSQL, Node.js | PHP-FPM, Nginx, Redis, PostgreSQL |