I have created a jenkins slave with work directory. I then have a maven java application with a Dockerfile.
#### BUILD image ### FROM maven:3-jdk-11 as builder RUN mkdir -p /build WORKDIR /build COPY pom.xml /build RUN mvn -B dependency:resolve dependency:resolve-plugins COPY /src /build/src RUN mvn package ### RUN ### FROM openjdk:11-slim as runtime EXPOSE 8080 ENV APP_HOME /app ENV JAVA_OPTS="" RUN mkdir $APP_HOME RUN mkdir $APP_HOME/config RUN mkdir $APP_HOME/log RUN mkdir $APP_HOME/src VOLUME $APP_HOME/log VOLUME $APP_HOME/config WORKDIR $APP_HOME COPY --from=builder /build/src $APP_HOME/src COPY --from=builder /build/target $APP_HOME/target COPY --from=builder /build/target/*.jar app.jar ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar app.jar" ]
Jenkins slave sees this Dockerfile and executes it. It builds the target folder. In the target folder, I have Jacoco to show code coverage.
Jenkins slave workspace is unable to see that target folder to show Code Coverage on the Jenkins jacoco page. How can i make this visible? I tried volumes in my docker-compose file as shown
version: '3' services: my-application-service: image: 'my-application-image:v1.0' build: . container_name: my-application-container ports: - 8090:8090 volumes: - /home/bob/Desktop/project/jenkins/workspace/My-Application:/app
However, I am not able to get target folder in the workspace. How can i let jenkins slave see this jacoco code coverage?