title: Docker-Compose build image from Git repo
body: <p>I should start by saying this I am aware that this project structure may not be ideal, but this is what the higher-ups want so I cannot change this.</p>
  <p>I have multiple Java projects in one repo which I'd like to containerise into a single container:</p>
  <pre><code>- main
      - project1
      - project2
      - Dockerfile
  </code></pre>
  <p>I have no issue with that; my issue is that I need some other code from a (public) GitHub repo to be running in its own container, within my project container.</p>
  <pre><code>- main-container
      - project1
      - project2
      - git-repo-container
  </code></pre>
  <p>I can clone the repository and get it into the container with no issue (assuming <code>git</code> has been installed in a previous <code>RUN</code> command):</p>
  <pre><code>RUN git clone --progress --verbose https://github.com/user/repo.git
  </code></pre>
  <p>Now, I'm completely stumped on how I go about building and running the container specified in the repo's <code>Dockerfile</code>.</p>
  <p>Naturally, I turned to <code>docker-compose</code>:</p>
  <pre><code>version: &quot;3.9&quot;
  services:
    my-image:
      build: .
      image: my-image
      ports:
        - 8080
        - 8100
    repo-image:
      build: .
      image: repo-image
      ports:
        - 8000
  </code></pre>
  <p>I'm new to <code>docker-compose</code> so this seems a little confusing to me but I am aware I can build images directly from GitHub. I'm just not sure how to specify the repo's <code>Dockerfile</code> given that I pull the repo in during the build phase (and would like to avoid installing docker in the container to run <code>docker build ...</code> in that container).</p>
  <p>I should add that I cannot just add the repo's source code to this codebase (not my decision) so pulling in the repo during the build phase appears to be my only option.</p>
  <p>As a bit of a side question, if permitted, is there a reason why VS code doesn't show the repo folder when I open the project in a dev container?</p>