2024-02-09 17:50:34 +01:00
|
|
|
####################################### Build stage #######################################
|
2024-02-20 15:01:31 +01:00
|
|
|
FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage
|
2024-02-09 17:50:34 +01:00
|
|
|
|
2024-02-20 15:01:31 +01:00
|
|
|
ARG MAVEN_ACCOUNT_USR
|
|
|
|
ARG MAVEN_ACCOUNT_PSW
|
|
|
|
ARG REVISION
|
|
|
|
ARG PROFILE
|
|
|
|
ARG DEV_PROFILE_URL
|
|
|
|
ENV server_username=$MAVEN_ACCOUNT_USR
|
|
|
|
ENV server_password=$MAVEN_ACCOUNT_PSW
|
2024-02-09 17:50:34 +01:00
|
|
|
|
|
|
|
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/*-dev.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/
|
|
|
|
|
2024-02-20 15:01:31 +01:00
|
|
|
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
|
2024-02-09 17:50:34 +01:00
|
|
|
# Build project
|
2024-02-20 15:01:31 +01:00
|
|
|
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
|
2024-02-09 17:50:34 +01:00
|
|
|
|
|
|
|
######################################## Run Stage ########################################
|
2024-02-20 15:01:31 +01:00
|
|
|
FROM eclipse-temurin:21-jre-ubi9-minimal
|
|
|
|
|
|
|
|
ARG PROFILE
|
|
|
|
ARG REVISION
|
2024-02-09 17:50:34 +01:00
|
|
|
|
2024-02-20 15:54:16 +01:00
|
|
|
COPY --from=build-stage /build/annotation-web/target/annotation-web-${REVISION}.jar /app/annotation-web.jar
|
2024-02-09 17:50:34 +01:00
|
|
|
|
2024-02-20 15:41:29 +01:00
|
|
|
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/annotation-web.jar"]
|