Answers: <p>Some thoughts:</p>
  
  <ol>
  <li>You do not have to clone the entire project.  <a href="https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa</a> discusses how to checkout a single file.  I have also had good results using curl to get single files off github.</li>
  <li>You can containerize it.  Like this </li>
  </ol>
  
  <blockquote>
  <pre><code>FROM docker/compose:1.21.2
  RUN mkdir /src
  WORKDIR /src
  COPY docker-compose.yml /src/docker-compose.yml
  ENTRYPOINT ["docker-compose"]
  CMD []
  </code></pre>
  </blockquote>
  
  <p>You can containerize docker-compose just like any other application.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-06-01T17:22:42.630Z
Answers: 2018-06-01T17:22:42.630Z
Answers: emory
Body: <p>I'm looking for best practices to share the Docker compose files created by developers with the people that do the deployment. </p>
  
  <p>We use 2 docker compose files: <code>docker-compose.yml</code> and <code>docker-compose.prod.yml</code>. </p>
  
  <p>These files are included in version control (git in our case).</p>
  
  <p>We have 2 options: </p>
  
  <ol>
  <li>Include the compose files in the master branch, and checkout the entire master branch when the application needs to be deployed. Pro here is that it is easy to keep everything in sync, con that the entire projects needs to be cloned on the server when the application is deployed.</li>
  <li>Include the compose files in a orphaned branch that can be checked out when the application needs to be deployed. The pro here is that only the compose files will be checked out, con that we have 2 branches that needs to be maintained. </li>
  </ol>
  
  <p>Since we are fairly new to this, I'm wondering how other organizations approach this, and why one method should be preferred over the other?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-06-05T15:44:27.930Z
Comments: I know the tension you are feeling ... we went with keeping the devops scripts and tooling in same github repo as the main app so things stay in sync better ... we have just one prod domain however 18 dev domains each on their own VPS server across various branches so keeping devops code in bed with the main code base does work and seems the simpler approach
Comments: Scott Stensland
Tags: <docker><docker-compose><dtap>
Title: What are best practices for sharing Docker compose files with ops team to use in Docker stack
UserDisplayName: Johan Vergeer
ThreadText: # What are best practices for sharing Docker compose files with ops team to use in Docker stack
  
  (Asked by: username_0 on 2018-06-01)
  
  I'm looking for best practices to share the Docker compose files created by developers with the people that do the deployment.
  
  We use 2 docker compose files: `docker-compose.yml` and `docker-compose.prod.yml`.
  
  These files are included in version control (git in our case).
  
  We have 2 options:
  
  1. Include the compose files in the master branch, and checkout the entire master branch when the application needs to be deployed. Pro here is that it is easy to keep everything in sync, con that the entire projects needs to be cloned on the server when the application is deployed.
  2. Include the compose files in a orphaned branch that can be checked out when the application needs to be deployed. The pro here is that only the compose files will be checked out, con that we have 2 branches that needs to be maintained.
  
  Since we are fairly new to this, I'm wondering how other organizations approach this, and why one method should be preferred over the other?
  
  **Tags:** docker, docker-compose, dtap
  
  > **Comments:**
  > **username_1**: I know the tension you are feeling ... we went with keeping the devops scripts and tooling in same github repo as the main app so things stay in sync better ... we have just one prod domain however 18 dev domains each on their own VPS server across various branches so keeping devops code in bed with the main code base does work and seems the simpler approach  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-06-01. Score: 2
  
  Some thoughts:
  
  1. You do not have to clone the entire project. <https://stackoverflow.com/questions/2466735/how-to-checkout-only-one-file-from-git-repository-sparse-checkout?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa> discusses how to checkout a single file. I have also had good results using curl to get single files off github.
  2. You can containerize it. Like this
  
  > ```
  > FROM docker/compose:1.21.2
  > RUN mkdir /src
  > WORKDIR /src
  > COPY docker-compose.yml /src/docker-compose.yml
  > ENTRYPOINT ["docker-compose"]
  > CMD []
  >
  > ```
  
  You can containerize docker-compose just like any other application.
  
  
  ---
  
  