Dockerfile fixes

This commit is contained in:
Alexandros Mandilaras 2024-02-20 15:35:56 +02:00
parent 2bbb2c35f6
commit fcf6ee4087
2 changed files with 30 additions and 4 deletions

View File

@ -3,8 +3,11 @@ FROM maven:3.9-eclipse-temurin-17-alpine AS build-stage
ARG CITE_MAVEN_ACCOUNT_USR
ARG CITE_MAVEN_ACCOUNT_PSW
ENV server_username=$CITE_MAVEN_ACCOUNT_USR
ENV server_password=$CITE_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 notification /build/notification/
@ -17,13 +20,16 @@ RUN rm -f /build/notification-web/src/main/resources/certificates/*.crt
WORKDIR /build/
RUN mvn -Dserver.username=${CITE_MAVEN_ACCOUNT_USR} -Dserver.password=${CITE_MAVEN_ACCOUNT_PSW} dependency:go-offline
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
# Build project
RUN mvn -Dserver.username=${CITE_MAVEN_ACCOUNT_USR} -Dserver.password=${CITE_MAVEN_ACCOUNT_PSW} clean package
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
######################################## Run Stage ########################################
FROM eclipse-temurin:17-jre-ubi9-minimal
ARG PROFILE
ARG REVISION
COPY --from=build-stage /build/notification-web/target/sti-viewer-notification-web.jar /app/sti-viewer-notification-web.jar
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/sti-viewer-notification-web.jar"]

View File

@ -8,5 +8,25 @@
<username>${server.username}</username>
<password>${server.password}</password>
</server>
<server>
<id>dev</id>
<username>${server_username}</username>
<password>${server_password}</password>
</server>
</servers>
<profiles>
<profile>
<id>dev</id>
<repositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repository>
<id>dev</id>
<name>Dev Profile</name>
<url>${devProfileUrl}</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>