I have written the following Dockerfile
to containerize a maven build:
FROM maven AS builder
WORKDIR /build
COPY . /build
RUN mvn -Dmaven.repo.local=.m2/repository clean test clover:instrument clover:clover clover:check findbugs:check package site
FROM amazoncorretto:8
COPY --from=builder /build/target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]
The second stage copies the jar file built by the first stage so that it can be used by its ENTRYPOINT
but I'd also like the docker host to get a copy of the entire target
directory from the container because it holds other build artefacts like code coverage and analysis reports.
Specifically, I'd like the copy to happen as part of the docker build -t fakefirehose .
Is this possible?