Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (12.7k points)

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

In order to be sure that everyone uses 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 (29.5k points)

Keep your Dockerfile with the source code. use labels to add versioning info to the produced image and add:

  • the git commit and branch
  • whether it's "dirty" meaning that changes were made locally on the src code from what's in git
  • a CI version number (publicly visible)
  • the person who built the image (not the person who last checked in git)

 also tag the image with the commit number.

Related questions

Browse Categories

...