diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index eeb94e3d7df3b720ea870066e896ae1a82812fdc..327db06943280cbab388f33bb9a5a7a74fed7bd2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,8 +12,7 @@ variables:
   TRAVIS_BUILD_DIR: "$CI_PROJECT_DIR"
 
 # gitlab ci script taken from https://gist.github.com/danielneis/5c6140ec8150c6151a54bccd26950278
-services:
-  - postgres:latest
+
 
 cache:
   paths:
@@ -34,30 +33,13 @@ build_webservice:
 
 test_maxima:
   image: moodlehq/moodle-php-apache:7.3
+  stage: test_maxima
+  services:
+  - postgres:latest
   variables:
     MOODLE_BRANCH: "MOODLE_37_STABLE"
     QSTACK_VERSION: "v4.3.2"
+  tags:
+    - docker
   script:
-  - apt update && apt install git-core postgresql-client texinfo
-  - cd $CI_PROJECT_DIR/..
-  - curl -sS https://getcomposer.org/installer | php
-  - mv composer.phar /usr/local/bin/composer
-  - composer create-project -n --no-dev moodlerooms/moodle-plugin-ci ci ^1
-  - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
-  - chmod u+x ci/bin/moodle-plugin-ci
-  - chmod u+x ci/bin/*
-  - umask u+x
-  - git clone --branch "$QSTACK_VERSION" https://github.com/maths/moodle-qtype_stack
-  - moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfexplicitvaildate
-  - moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfcbmexplicitvaildate
-  - moodle-plugin-ci add-plugin maths/moodle-qbehaviour_adaptivemultipart
-  - moodle-plugin-ci install --plugin moodle-qtype_stack
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_PLATFORM",        "server");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMAVERSION",   "5.41.0");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASTIMEOUT",      "10");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASRESULTSCACHE", "db");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMACOMMAND",   "http://kubecluster.test/godev/");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_PLOTCOMMAND",     "gnuplot");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMALIBRARIES", "stats, distrib, descriptive, simplex");'
-  - moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASDEBUGGING",    "0");'
-  - moodle-plugin-ci phpunit
+    - ./install.sh
diff --git a/testimage.sh b/testimage.sh
index c12a633619e4173784a7e423505544b6ac04f5c0..d3dd38ce702263c8ca90a62108a88300ebf74ed8 100644
--- a/testimage.sh
+++ b/testimage.sh
@@ -1,4 +1,31 @@
 #!/bin/bash
-# arg1 name of testimage
-cowsay $1 "cant be tested yet";
+apt-get update -y && apt-get install -y git-core postgresql-client texinfo maxima maxima-share
+curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
+. $HOME/.nvm/nvm.sh
+nvm install 14
+nvm use 14
+curl -sS https://getcomposer.org/installer | php
+mv composer.phar /usr/local/bin/composer
+composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci ^2
+export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
+chmod u+x ci/bin/moodle-plugin-ci
+chmod u+x ci/bin/*
+umask u+x
+git clone --branch "$QSTACK_VERSION" https://github.com/maths/moodle-qtype_stack
+moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfexplicitvaildate
+moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfcbmexplicitvaildate
+moodle-plugin-ci add-plugin maths/moodle-qbehaviour_adaptivemultipart
+
+moodle-plugin-ci install --plugin moodle-qtype_stack --db-host=postgres
+
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_PLATFORM",        "server");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMAVERSION",   "5.41.0");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASTIMEOUT",      "10");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASRESULTSCACHE", "db");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMACOMMAND",   "http://kubecluster.test/godev/");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_PLOTCOMMAND",     "gnuplot");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_MAXIMALIBRARIES", "stats, distrib, descriptive, simplex");'
+moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASDEBUGGING",    "0");'
+moodle-plugin-ci phpunit
+