Gradle run as non-root

Could you please let me know how to run a gradle image (pulled from docker repository) as a non-root user in Kubernetes POD?

I have build a gradle image using Gradle 4.6. I’m using this image in my Kubernetes Pod.
When I run the image as user - root, the gradle build is successful. When I run the image as non-root user, the build fails as gradle is unable to create /.gradle directory and there are no sufficient privileges.

Thanks in advance!