gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

COPY breaks due to DockerFile being copied to build/docker dir

Open bitsofinfo opened this issue 8 years ago • 3 comments

if your Dockerfile is in the root of a project, this task moves it to build/docker which breaks all source paths specified in one's docker file....

bitsofinfo avatar Jul 03 '16 20:07 bitsofinfo

You can use gradle's copy to create a task to be run as a dependency of the main task to copy your dependant files into the build directory, as a workaround.

I ran into this issue as well, and used this as the solution.

sanimalp avatar Jul 12 '16 20:07 sanimalp

I just switched this https://github.com/bmuschko/gradle-docker-plugin/

problems solved

bitsofinfo avatar Jul 15 '16 19:07 bitsofinfo

Adding on to the workaround suggested by @sanimalp, below snippet is an example. Note: In this case, all dependent files are placed to docker directory, and initBuildContext task copies its contents to build/docker directory.

task initBuildContext(type: Copy)   {
    from 'docker'
    into 'build/docker'
}

distDocker {
    dockerfile = 'Dockerfile'
}

distDocker.dependsOn 'initBuildContext'

abhishek-mvr avatar May 29 '21 07:05 abhishek-mvr