Best practices for managing Docker configuration (Dockerfile, Compose, .env) across Dev and Production environments?

hi everyone,

I am working on a web project (a developer Q&A platform) using Laravel, Next.js, and FrankenPHP. I want to implement a professional DevOps workflow and I’m looking for the most efficient way to organize my Docker setup for both Development and Production environments.

Specifically, I’m looking for advice on:

  1. Project Structure: Should I use a single docker-compose.yml with overrides (docker-compose.override.yml) or separate files like docker-compose.dev.yml and docker-compose.prod.yml?
  2. Dockerfile Management: Is a multi-stage build the industry standard for handling both dev dependencies (like hot-reloading/debug tools) and production optimizations in a single Dockerfile?
  3. Environment Variables: How should I manage .env files? Is it better to have separate .env.development and .env.production files, or should I rely on the orchestrator (or CI/CD secrets) to inject them?
  4. Best Practices: What is the most “clean” and maintainable way to handle common services (like DB, Redis) while changing only the web server configuration (e.g., FrankenPHP settings) between environments?

I’m aiming for a setup that is easy to manage via GitHub Actions for CI/CD.