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

Your can use Anchors to make the .gitlab-ci.yml more clearly. (But this need GitLab 8.6 and GitLab Runner v1.1.1.)

Like this:

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_template: &build_definition
  script:
    - mkdir build/
    - cd build
    - cmake -D CMAKE_BUILD_TYPE=Debug ../
    - make

build:precise:
  image: precise:base
  <<: *build_definition

build:trusty:
  image: trusty:base
  <<: *build_definition