Gitlab runner: It is possible running an docker image that depends from another

550 Views Asked by At

The scenario it's the following:

I need run grunt serve that serve my app in localhost:9000 in my process of continuous integration using a docker container, then I need run another container that, using the application served in the localhost:9000, executes a integration testing:

My gitlab.yml file

unit-testing:
  image: karma-testing
  script:
    - npm install && bower install && karma start && grunt serve
  cache:
    paths:
    - node_modules/
    - bower_components/

behavior-testing:
  image: protractor-ci
  script:
    - npm install protractor-cucumber-framework cucumber && xvfb-run --server-args='-screen 0 1280x1024x24' protractor protractor.conf.js
  cache:
    paths:
    - node_modules/
    - bower_components/

The first image run the grunt serve task that serve my app in localhost:9000 and I want that the second image uses this running app for running the another script.

1

There are 1 best solutions below

2
Markus Kasten On BEST ANSWER

No, you can't do that. Jobs can run on different runners and you can't tell for sure if they are run in parallel or serial order.

You can and should run the grunt server in the same task as the one using it. A prepared docker image or special YAML features might be useful here.