Gradle - Docker Issue

Hello Everyone,

I am currently migrating my project from bitbucket and bamboo being used for CI/CD to gitlab. My plan is to use the CI/CD Pipeline from gitlab for my projects.

The existing project I have is a Java Project with Gradle. The configuration file I am using is the following:

stages:

  • Build Gradle

build:
stage: Build Gradle
image: openjdk:11
variables:
GRADLE_OPTS: “-Dorg.gradle.daemon=false”

before_script:

  • export GRADLE_USER_HOME=pwd/.gradle
    script:
  • chmod +x ./gradlew
  • ./gradlew :api:bootJar
  • cd api/build
  • ls -l
  • cd docker
    artifacts:
    paths:
  • build/libs/*.jar
    expire_in: 1 day
    cache:
    paths:
    • .gradle/wrapper
    • .gradle/caches

The issue is that while the above command will be executed it won’t build the docker folder under ./build/api/ which will contain the Dockerfile needed by my application.

If i will change the " - ./gradlew :api:bootJar" to " - ./gradlew :api:docker" I receive an error message stating that "command not found: docker

I have tried to install docker on a before_step but still getting the same “command not found: docker” error message