Transmode / gradle-docker

A Gradle plugin to build Docker images from the build script.
Apache License 2.0
647 stars 142 forks source link

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

Open bitsofinfo opened 8 years ago

bitsofinfo commented 8 years ago

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....

sanimalp commented 8 years ago

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.

bitsofinfo commented 8 years ago

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

problems solved

abhishek-mvr commented 3 years ago

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'