title: Docker Compose Dev and Production Environments Best Workflow
body: <p>I've built a simple Docker Compose project as a development environment. I have PHP-FPM, Nginx, MongoDB, and Code containers.<br>
  Now I want to automate the process and deploy to production.<br>
  The <code>docker-compose.yml</code> can be extended and can define multiple environments. See <a href="https://docs.docker.com/compose/extends/" rel="nofollow">https://docs.docker.com/compose/extends/</a> for more information.<br>
  However, there are Dockerfiles for my containers. And for the dev environment are needed more packages than in production.</p>
  
  <p>The main question is should I use separate dockerfiles for <code>dev</code> and <code>prod</code> and manage them in <code>docker-compose.yml</code> and <code>production.yml</code> ?<br>
  Separate dockerfiles are easy approach but there is code duplication.</p>
  
  <p>The other solution is to use environment variables and somehow handle them from bash script (maybe as entrypoint ?).</p>
  
  <p>I am searching for other ideas.</p>