Skip to content

Building Docker Image with Gradle fails with “COPY failed: no source files were specified” #150

@arafatmohammed

Description

@arafatmohammed

I am new to Gradle. I am trying to build a Dockerfile from within my build.gradle

Dockerfile

FROM camunda/camunda-bpm-platform:tomcat-7.7.0

COPY build/libs/*.war /camunda/webapps/
COPY camunda/ /camunda/webapps/engine-rest/WEB-INF/
COPY definitions/ /camunda/definitions/

build.gradle

    task buildDocker(type: Docker, dependsOn: build) {
        push = false
        dockerfile = file("Dockerfile")
        version release.version
        tag = "${docker_registry_url}/camunda"
        doFirst {
            copy {
                from war
                into stageDir
            }
            copy {
                from "${projectDir}/camunda/"
                into stageDir
            }
            copy {
                from "${projectDir}/definitions/"
                into stageDir
            }
        }
    }

Output

./gradlew clean build buildDocker --info

Execution failed for task ':buildDocker'. Docker execution failed Command line [docker build -t 73299472920.dkr.ecr.us-east-1.amazonaws.com/camunda:0.0.0.uncommitted-71119c2 /Users/amx/Code/backend/jclaim/build/docker] returned:

COPY failed: no source files were specified

I am able to build this image manually from the same Dockerfile using docker build -t but somehow it fails in Gradle buildDocker task.

It even works when I do not add the last two COPY

Dockerfile

FROM camunda/camunda-bpm-platform:tomcat-7.7.0

COPY build/libs/*.war /camunda/webapps/

But I have to COPY the other two artifacts as well.

My Docker plugin for Docker:

se.transmode.gradle:gradle-docker:1.2

Gradle Version:

Gradle 5.1.1

Please help me fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions