<p>Is this possible to set up a config, which would include:</p>

<ol>
<li>GitLab project #1 java-container </li>
<li>GitLab project #2 java-container </li>
<li>Nginx container</li>
<li>Redis container</li>
<li>Cassandra container</li>
<li>Nginx exporter (Prometheus)</li>
<li>Redis exporter (Prometheus)</li>
<li>JMX exporter (Prometheus) x2</li>
</ol>

<p>It's important to have all this in one multi-container pod on kubernetes (GKE) and communicating via shared volume and localhost.</p>

<p>I've already done all this in kubernetes with initial containers (to pull the code and compile it), and now I'm looking for the way to make this work with CI/CD.</p>

<p>So, if this could be done with GitLab CI, could you, please, point me to the right documentation or manual pages, as I'm a newbie in GitLab CI and stuff, and have already lost myself in dozens of articles from the internet.</p>

<p>Thanks in advance. </p>

<p>The first thing is to join all projects, that should be built with maven and(or) docker into the one common project at GitLab.</p>

<p>Next is to add dockerfiles and all files, needed for docker build, into the sub-projects folders.</p>

<p>Next in the root of the common project we should we should place .gitlab-ci.yml and deployment.yml file. </p>

<p>deployment.yml should be common or all the sub-project. </p>

<p>.gitlab-ci.yml should contain all the stages to build every sub-project. As we don't need to build all the stuff every time we make changes in sime files, we should use tags in git to make GitLab CI understand, in which case it should run one or another stage. This could be implemented by <code>only</code> <a href="http://docs.gitlab.com/ce/ci/yaml/README.html#only-and-except" rel="nofollow noreferrer">parameter</a>:</p>

<pre><code>docker-build-akka:
  stage: package
  only:
    - /^akka-.*$/
  script:
  - export DOCKER_HOST="tcp://localhost:2375"
...
</code></pre>

<p>And so on in every stage. So, if you make changes to needed Dockerfile or java code, you should commit and push to gitlab with a tag like <code>akka-0.1.4</code>, and GitLab CI runner will run only the appropriate stages. </p>

<p>Also, if you make changes to README.md file or any other changes, that don't need to build the project - it wouldn't.</p>

<p>Lots of useful stuff you can find <a href="https://about.gitlab.com/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/" rel="nofollow noreferrer">here</a> and <a href="http://docs.gitlab.com/ce/ci/yaml/README.html" rel="nofollow noreferrer">here</a>.</p>

<p>Also, look at the <a href="https://stackoverflow.com/a/42903164/3906452">problem</a>, that I faced running docker build stage in kubernetes. It might me helpful. </p>
