Building with Gradle via Bitbucket Pipeline

Viewed 282

I have an application that I am attempting to build using Gradle. Currently I am able to build it locally, but would like to have it integrated within a Bitbucket pipeline. The current process generates a zip file after Gradle task is successfully executed. The zip file then gets copied over to a Docker image defined via Dockerfile. The current blocker I am facing in the pipeline deals with part where the Docker image is being built. I am getting an error when building the Docker image that the associated zip file does not exist. I do not believe the dockerfile is incorrect. Any advice on how to get a Bitbucket pipeline to execute a Gradle task and create this zip file would be appreciated. Below is my dockerfile and my Gradle related files.

Dockerfile

FROM centos:7

COPY /src/main/build/zip-file.zip /tmp/zip-file.zip

build.gradle

task zip(type: Zip) {
   from fileTree('./zip')
   exclude '.vscode'
   exclude 'node_modules/*'
   exclude 'middle-tier/node_modules/*'
   exclude 'ui/node_modules/*'
   archiveName "${ZipFilename}"
   destinationDir(file("${ZipPath}"))
}

In the pipeline I am using the following command to create the zip file ./gradlew zip After executing that command, a zip file gets generated locally, but the pipeline fails when trying to copy the zip over. Any advice how to get a pipeline to recognize this would be helpful.

0 Answers
Related