I have following Dockerfile.When I push the code into git remote, docker build stage with gradle gave me following error:
Execution failed for task ':compileJava'.
> Could not resolve all dependencies for configuration ':detachedConfiguration1'.
> Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.7.3 because no repositories are defined.
Because I dont want to send remote repository credentials into vcs for security.But I dont know how handle repository credentials definitions in docker.
FROM nexus-host:10441/gradle:8.1.1-jdk11-alpine AS builder
WORKDIR /usr/app/
COPY . .
RUN gradle bootJar
FROM nexus-host:10441/openjdk:11-jre-slim
WORKDIR /
COPY --from=builder /usr/app/build/libs/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]