title: Building Docker image as non root user
body: <p>New here, was wondering if someone had experience with building images as non root user?</p>
  <p>I am building Kotlin project, (2 step build) and my goal is now to build it as non root user. Here is what my Dockerfile looks like. Any help would be appreciated:</p>
  <pre><code># Build
  FROM openjdk:11-jdk-slim as builder
  
  # Compile application
  WORKDIR /root
  COPY . .
  RUN ./gradlew build
  
  FROM openjdk:11-jre-slim
  
  # Add application
  COPY --from=builder /root/build/libs/*.jar ./app.jar
  
  # Set the build version
  ARG build_version
  ENV BUILD_VERSION=$build_version
  
  COPY docker-entrypoint.sh /
  RUN chmod 777 /docker-entrypoint.sh
  CMD /docker-entrypoint.sh
  </code></pre>