argos/dmp-backend/Dockerfile

38 lines
1.2 KiB
Docker
Raw Normal View History

2024-02-22 08:30:30 +01:00
####################################### Build stage #######################################
FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage
2020-04-27 15:21:03 +02:00
2024-02-22 08:30:30 +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
2020-04-27 15:21:03 +02:00
COPY pom.xml /build/
2024-04-05 12:32:07 +02:00
COPY core /build/core/
2020-04-27 15:21:03 +02:00
COPY web /build/web/
2024-04-05 12:32:07 +02:00
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/web/src/main/resources/config/*-devel.yml
RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml
2020-04-27 15:21:03 +02:00
WORKDIR /build/
2024-02-22 08:30:30 +01:00
#RUN mvn package -q
2024-04-05 12:35:13 +02:00
RUN mvn -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
2024-02-22 08:30:30 +01:00
# Build project
2024-04-05 12:35:13 +02:00
RUN mvn -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
2024-02-22 08:30:30 +01:00
######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine
2020-04-27 15:21:03 +02:00
WORKDIR /app
2024-02-22 08:30:30 +01:00
ARG PROFILE
2024-02-22 10:52:47 +01:00
ARG REVISION
2024-04-05 12:32:07 +02:00
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
2024-02-22 08:30:30 +01:00
2024-02-22 10:52:47 +01:00
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app.jar
2024-02-22 08:30:30 +01:00
2024-04-05 12:32:07 +02:00
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Djava.security.egd=file:/dev/./urandom" ,"-Dspring.profiles.active=${PROFILE}","-jar","/app.jar"]