title: How to configure different dockerfile for development and production
body: <p>I use docker for development and in production for laravel project. I have slightly different dockerfile for development and production. For example I am mounting local directory to docker container in development environment so that I don't need to do docker build for every change in code. </p>
  
  <p>As mounted directory will only be available when running the docker container I can't put commands like "composer install" or "npm install" in dockerfile for development.</p>
  
  <p>Currently I am managing two docker files, is there any way that I can do this with single docker file and decide which commands to run when doing docker build by sending parameters.</p>
  
  <p><strong>What I am trying to achieve is</strong> </p>
  
  <p><strong>In docker file</strong></p>
  
  <pre><code>...
  IF PROD THEN RUN composer install
  ...
  </code></pre>
  
  <p><strong>During docker build</strong></p>
  
  <pre><code>docker build [PROD] -t mytag .
  </code></pre>