Issue
So i want to set the docker image name as a file it creates. the stages inside the dockerfile are: set new version for pom.xml, compile, package all using mvn. i want to set the docker image name as the artifact the build creates Example: my-app-1.0.1
FROM maven:3-jdk-8-alpine AS build
ADD . /my-app
WORKDIR /my-app
RUN mvn versions:set -DnewVersion="1.0.1"
RUN mvn compile
RUN mvn package
FROM openjdk:8-jdk-alpine
COPY --from=build /my-app/target/my-app-1.0.1.jar my-app-1.0.1.jar
ENTRYPOINT ["java" "-cp" "my-app-1.0.1.jar" "com.mycompany.app.App"]
Thanks!
Solution
So as Thorbjørn Ravn, Andersen and Max advised I changed my approach. i set it outside and put it right with the image build command. Thanks for the help everyone! command help
Answered By - lolik
Answer Checked By - Marie Seifert (JavaFixing Admin)