####################################### Build stage ####################################### FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage ARG MAVEN_ACCOUNT_USR ARG MAVEN_ACCOUNT_PSW ARG REVISION ARG PROFILE ENV server_username=$MAVEN_ACCOUNT_USR ENV server_password=$MAVEN_ACCOUNT_PSW ARG CITE_MAVEN_REPO_URL COPY pom.xml /build/ COPY annotation /build/annotation/ COPY annotation-web /build/annotation-web/ COPY settings.xml /root/.m2/settings.xml RUN rm -f /build/annotation-web/src/main/resources/config/app.env RUN rm -f /build/annotation-web/src/main/resources/config/*-devel.yml RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml RUN rm -f /build/annotation-web/src/main/resources/certificates/*.crt WORKDIR /build/ RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install # Build project RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package ######################################## Run Stage ######################################## FROM eclipse-temurin:21-jre-ubi9-minimal ARG PROFILE ARG REVISION ENV SERVER_PORT=8080 EXPOSE ${SERVER_PORT} COPY --from=build-stage /build/annotation-web/target/annotation-web-${REVISION}.jar /app/annotation-web.jar ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/annotation-web.jar"]