.gradle is getting created with root user

I’m trying to dockerize the Gradle build. Running the container as non root user. So far it is working good, but somehow “.gradle” file is getting created with root user ownership causing a build failure. Greatly appreaciated if any help from the community.