38 lines
1.5 KiB
Docker
38 lines
1.5 KiB
Docker
####################################### 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
|
|
ARG DEV_PROFILE_URL
|
|
ENV server_username=$MAVEN_ACCOUNT_USR
|
|
ENV server_password=$MAVEN_ACCOUNT_PSW
|
|
|
|
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 -Dserver.username=${CITE_MAVEN_ACCOUNT_USR} -Dserver.password=${CITE_MAVEN_ACCOUNT_PSW} clean
|
|
RUN mvn -Dserver.username=${CITE_MAVEN_ACCOUNT_USR} -Dserver.password=${CITE_MAVEN_ACCOUNT_PSW} install
|
|
# Build project
|
|
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_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"] |