Dpl requires Ruby version >= 2.2 on deploy to Heroku

Hi, I trying to to deploy Spring Boot application on Heroku.

Here gitlab-ci.yml:

image: java:8-jdk

stages:

  • build
  • test
  • deploy

before_script:
#- echo pwd # debug
#- echo “$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE” # debug

  • export GRADLE_USER_HOME=pwd/.gradle
  • chmod +x ./gradlew

cache:
paths:
- .gradle/wrapper
- .gradle/caches

build:
stage: build
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
only:
- master

test:
stage: test
script:
- ./gradlew check

deploy:
stage: deploy
script:
- apt-get update -yq
- apt-get install ruby-dev rubygems -y
- gem install dpl
- dpl --provider=heroku --app=zzchecker --api-key=$HEROKU_API_KEY

after_script:

  • echo “End CI”

And this logs from pipeline:

apt-get install ruby-dev rubygems -y Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: gcc-4.9-base javascript-common libasan0 libatomic1 libc-dev-bin libc6 libc6-dev libgcc-4.8-dev libgcc1 libgmp-dev libgmpxx4ldbl libgomp1 libitm1 libjs-jquery libquadmath0 libruby2.1 libstdc++-4.8-dev libstdc++6 libtsan0 libyaml-0-2 linux-libc-dev manpages manpages-dev ruby2.1 ruby2.1-dev rubygems-integration Suggested packages: apache2 lighttpd httpd glibc-doc locales libgmp10-doc libmpfr-dev libstdc++-4.8-doc man-browser ri bundler The following NEW packages will be installed: javascript-common libasan0 libatomic1 libc-dev-bin libc6-dev libgcc-4.8-dev libgmp-dev libgmpxx4ldbl libgomp1 libitm1 libjs-jquery libquadmath0 libruby2.1 libstdc++-4.8-dev libtsan0 libyaml-0-2 linux-libc-dev manpages manpages-dev ruby ruby-dev ruby2.1 ruby2.1-dev rubygems-integration The following packages will be upgraded: gcc-4.9-base libc6 libgcc1 libstdc++6 4 upgraded, 24 newly installed, 0 to remove and 85 not upgraded. Need to get 20.0 MB of archives. ... gem install dpl
ERROR: Error installing dpl:
dpl requires Ruby version >= 2.2.
Running after script…
$ echo “End CI”

How to solve this issue? Can I specify Ruby version manually?

Solved by changing Docker image to openjdk:8-jdk