Transmode / gradle-docker

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

EntryPoint #159

Open jc9464 opened 3 years ago

jc9464 commented 3 years ago

I have the following in my build.gradle:

distDocker { tagVersion = project.tagVersion registry = rootProject.group addFile("runpdb", "/bin/runpdb") entryPoint(["/bin/runpdb"]) }

However, the Dockerfile created still insists on having the default entryPoint. The end result is that there are 2 ENTRYPOINT entries in the Dockerfile.

Is there some way to tell it not to put the default ENTRYPOINT entry in? I want to override it with the entrypoint that I've provided. The one I've provided needs to be the only one in the generated Dockerfile.

mpetuska commented 3 years ago

Here's a quick workaround you can apply on distDocker task

doLast {
        val dockerfile = stageDir.resolve("Dockerfile")
        val content = dockerfile.readLines()
        dockerfile.writeText(content.slice(0 until (content.size - 2)).joinToString("\n"))
}

It basically removes default ENTRYPOINT and ADD commands. Change 2 to 1 if you want to keep ADD command.