Transmode / gradle-docker

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

Cannot find switchUser in DockerTask #136

Closed kbyyd24 closed 6 years ago

kbyyd24 commented 6 years ago

I found that I can use switchUser(String usernameOrId) method in DockerTask in readme. But I cannot find the method in the class.

How can I use it?

My gradle is this:

task stubDocker(type: Docker, dependsOn: build) {
    switchUser('root')
    addFile(file("${buildDir}/libs/${rootProject.name}-${version}.jar"), "/root/stub-runner.jar")
    exposePort(9999)
    defaultCommand(["java", "-jar", "~/stub-runner.jar"])
}
bjornmagnusson commented 6 years ago

Unfortunately this functionality is not available in any released version, only in the master. You may try it out by publishing the project jar to maven local, using the task publishToMavenLocal. This will publish gradle-docker artifact into your local maven repo with the version 1.3-SNAPSHOT