title: What code-repository should the Dockerfile get committed to?
body: <h1>Long story short</h1>
  
  <p>Where should I commit the Dockerfile? In the project codebase or in the devops codebase?</p>
  
  <p>Reasoning details:</p>
  
  <h2>Without docker and without CI</h2>
  
  <p>In the ancient times, when developing a complex application with multiple code-bases, one normally wanted to have one repo per project and have all the passwords, credentials and dev/test/pre/prod configurations separated from the code.</p>
  
  <pre><code>+-----------------------------------------------------------------------+
  |                                                                       |
  |  +---------+       +---------+       +---------+       +---------+    |
  |  |  app-1  |       |  app-2  |       |  app-3  |       |  app-4  |    |
  |  +---------+       +---------+       +---------+       +---------+    |
  |                                                                       |
  |                            +----+                                     |
  |                            |    |\                                    |
  |                            |    +-+                                   |
  |                            | conf |                                   |
  |                            | files|                                   |
  |                            +------+                                   |
  |                                                                       |
  +-----------------------------------------------------------------------+
  </code></pre>
  
  <p>In the old-ancient times one sysadmin installed the software in the server and then later copied the config files. Back in the 90's usually the sysop had those files in a directory of his own, shared only with the boss.</p>
  
  <h2>With CI but still without docker</h2>
  
  <p>Later we improved the cycle: in Continuos development/integration environments, "the system" itself needs to be able to clone all those repos and be able to "build" the applications and configure them to be ready to be run. Then copy the build into the servers and configure them accordingly.</p>
  
  <p>This enables all the developers to trigger deploys at production, still not compromising the secret keys.</p>
  
  <p>Before containers, typically the companies had an extra "devops" (AKA CI repo) where we had all those config files organized and know by an script. The CI server (pre-docker) knows all the source-code repos, knows the destination-network-topology, has the passwords to the cloud, and copies/builds/deploys everything in its destination and also configures it, making unnecessary the human intervention provided the servers are up and running.</p>
  
  <pre><code>+-----------------------------------------------------------------------+
  |                                                                       |
  |  +---------+       +---------+       +---------+       +---------+    |
  |  |  app-1  |       |  app-2  |       |  app-3  |       |  app-4  |    |
  |  +---------+       +---------+       +---------+       +---------+    |
  |                                                                       |
  |                          +----------------+                           |
  |                          |     devops     |                           |
  |                          +----------------+                           |
  |                          | config-1-devel |                           |
  |                          | config-1-pre   |                           |
  |                          | config-1-prod  |                           |
  |                          | config-2-devel |                           |
  |                          |      [...]     |                           |
  |                          | config-4-prod  |                           |
  |                          +----------------+                           |
  |                                                                       |
  +-----------------------------------------------------------------------+
  </code></pre>
  
  <h2>CI with Docker</h2>
  
  <p>When it comes to make docker play a role in the equation, I wonder if the correct place to have the Dockerfile is inside the application CVS repository or in the devops repository.</p>
  
  <h2>Will the Dockerfile go into the app code-base?</h2>
  
  <p>Unless we do an open-source code that needs to run in many platforms, usually the companies establish a target platform and the coders "know" the target system will be an Ubuntu, or a CentOs or so beforehand.</p>
  
  <p>On the other hand it is now that the coders themselves touch the Dockerfile as one moe source-code file. This pushes us to think that the Dockerfile fits in each code-base as the app and the system it runs in will be -probably- coupled by needing certain requirements.</p>
  
  <pre><code>+-----------------------------------------------------------------------+
  |                                                                       |
  | +-------------+   +-------------+   +-------------+   +-------------+ |
  | |    app-1    |   |    app-2    |   |    app-3    |   |    app-4    | |
  | +-------------+   +-------------+   +-------------+   +-------------+ |
  | |Dockerfile-1 |   |Dockerfile-2 |   |Dockerfile-3 |   |Dockerfile-4 | |   
  | +-------------+   +-------------+   +-------------+   +-------------+ |
  |                                                                       |
  |                          +----------------+                           |
  |                          |     devops     |                           |
  |                          +----------------+                           |
  |                          | config-1-devel |                           |
  |                          | config-1-pre   |                           |
  |                          | config-1-prod  |                           |
  |                          | config-2-devel |                           |
  |                          |      [...]     |                           |
  |                          | config-4-prod  |                           |
  |                          +----------------+                           |
  |                                                                       |
  +-----------------------------------------------------------------------+
  </code></pre>
  
  <h2>Or will the Dockerfile go into the devops code-base (AKA the CI server code-base)?</h2>
  
  <p>But also it seems the programmer should do the very same lines of code, for example if he is coding a web application, despite it is run under an apache, an nginx or a caddy server... so the "decission" of the runtime seems it should be coded into the devops code-base:</p>
  
  <pre><code>+-----------------------------------------------------------------------+
  |                                                                       |
  | +-------------+   +-------------+   +-------------+   +-------------+ |
  | |    app-1    |   |    app-2    |   |    app-3    |   |    app-4    | |
  | +-------------+   +-------------+   +-------------+   +-------------+ |
  |                                                                       |
  |                          +----------------+                           |
  |                          |     devops     |                           |
  |                          +----------------+                           |
  |                          | Dockerfile-1   |                           |
  |                          | Dockerfile-2   |                           |
  |                          | Dockerfile-3   |                           |
  |                          | Dockerfile-4   |                           |
  |                          +----------------+                           |
  |                          | config-1-devel |                           |
  |                          | config-1-pre   |                           |
  |                          | config-1-prod  |                           |
  |                          | config-2-devel |                           |
  |                          |      [...]     |                           |
  |                          | config-4-prod  |                           |
  |                          +----------------+                           |
  |                                                                       |
  +-----------------------------------------------------------------------+
  </code></pre>
  
  <p>In the team we can't clarify the proper way and I've searched but I am unable to find documentation that demonstrates if the different Dockerfiles should be committed into the app repos or in the devops repo (AKA CI repo).</p>
  
  <p>Where should I commit them?</p>