Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (19.4k points)

We are a few developers currently developing a C++ app.

In order to be sure that everyone use the same libraries and dependencies than the remote production server, we are using docker to compile the code source in our localhost.

My question is what the best practices to use git with docker?

  1. Add the Dockerfile to the source code repository
  2. Create a dedicated repository for all our Dockerfiles
  3. Created a dedicated repository for each Dockerfile
  4. Others?

1 Answer

0 votes
by (27.5k points)

I don't think keeping the Dockerfile with the sources is the best practice, because the purpose of each is different. Docker and Dockerfile usually belong to the devops world, and behave independently from the actual software. e.g. Docker is one way of deploying your software, but it's not the only one. Your Dockerfile may in the future aggregate software from another git repository - in which repo will you keep it?

A change in the software should not systematically impact the version of the Dockerfile repo branch. Also a change in the dockerfile should not impact the version of the Software repo branch. But sometimes I can understand that the Dockerfile is so tightly coupled to the software source that in fact you just want to store them all together for simplicity sake. But I'd not make it a standard in any way. 

So, I'd rather go for 2 or 3.

Related questions

Browse Categories

...