Multiple Docker images in .gitlab-ci.yml

Here is my problem setup with GitLab and its integrated CI service. I have a current GitLab 8.1. and a gitlabci-multi-runner (0.6.2) with Docker support. After extending the ubuntu:precise image to include git and build-essentials (now named precise:base) I got the following .gitlab-ci.yml running:

image: precise:base
before_script:
   - apt-get install --yes cmake libmatio-dev libblas-dev libsqlite3-dev libcurl4-openssl-dev
   - apt-get install --yes libarchive-dev liblzma-dev

build:
  script:
    - mkdir build/
    - cd build
    - cmake -D CMAKE_BUILD_TYPE=Debug ../
    - make

Now my question is how to include more jobs on different images? Because I need to check if the code compiles (and later on works) on different operating systems like Ubuntu Precise, Ubuntu Trusty, CentOS 6, CentOS 7. To reduce the work I think the best way is to provide different Docker images as base.

  • What do I need for Travis-CI to decrypt secure variables on my fork?
  • Skip a submodule during a maven build
  • Jenkins guide needed for build, deploy, provision and rollback, keeping 5 releases
  • Jenkins cannot access to SVN (https://)
  • stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC
  • Difference between Team Foundation Server and Team Services
  • Now the questions is how must the .gitlab-ci.yml look like to support this?

  • Is there a way to skip password typing when using https:// on GitHub?
  • Import an existing Git repository into IntelliJ IDEA
  • Possible to use git project AND see TFS work items in VS2013?
  • Show all stashes in git log
  • force update the current branch - how?
  • In a git hook is the current working directory guaranteed to be within the git repository?
  • One Solution collect form web for “Multiple Docker images in .gitlab-ci.yml”

    You can define the image to use per job.

    For instance:

    before_script:
       - apt-get install --yes cmake libmatio-dev libblas-dev libsqlite3-dev libcurl4-openssl-dev
       - apt-get install --yes libarchive-dev liblzma-dev
    
    build:precise:
      image: precise:base
      script:
        - mkdir build/
        - cd build
        - cmake -D CMAKE_BUILD_TYPE=Debug ../
        - make
    
    build:trusty:
      image: trusty:base
      script:
        - mkdir build/
        - cd build
        - cmake -D CMAKE_BUILD_TYPE=Debug ../
        - make
    
    Git Baby is a git and github fan, let's start git clone.