argos/notification-service/Dockerfile

37 lines
1.4 KiB
Docker
Raw Normal View History

2023-12-08 10:25:07 +01:00
####################################### Build stage #######################################
2024-02-20 14:59:01 +01:00
FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage
2023-12-08 10:25:07 +01:00
2024-02-20 14:47:55 +01:00
ARG MAVEN_ACCOUNT_USR
ARG MAVEN_ACCOUNT_PSW
2024-02-20 14:35:56 +01:00
ARG REVISION
ARG PROFILE
ARG DEV_PROFILE_URL
ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
2023-12-08 10:25:07 +01:00
COPY pom.xml /build/
COPY notification /build/notification/
COPY notification-web /build/notification-web/
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/notification-web/src/main/resources/config/app.env
RUN rm -f /build/notification-web/src/main/resources/config/*-dev.yml
RUN rm -f /build/notification-web/src/main/resources/logging/*.xml
RUN rm -f /build/notification-web/src/main/resources/certificates/*.crt
WORKDIR /build/
2024-02-20 14:35:56 +01:00
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
2023-12-08 10:25:07 +01:00
# Build project
2024-02-20 14:35:56 +01:00
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
2023-12-08 10:25:07 +01:00
######################################## Run Stage ########################################
2024-02-20 14:59:01 +01:00
FROM eclipse-temurin:21-jre-ubi9-minimal
2023-12-08 10:25:07 +01:00
2024-02-20 14:35:56 +01:00
ARG PROFILE
ARG REVISION
2024-02-21 09:49:06 +01:00
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
2024-02-20 14:35:56 +01:00
2024-02-21 09:49:06 +01:00
COPY --from=build-stage /build/notification-web/target/notification-web-${REVISION}.jar /app/notification-web.jar
2023-12-08 10:25:07 +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/notification-web.jar"]