Dockerfile changes

This commit is contained in:
Diamantis Tziotzios 2024-04-08 13:31:46 +03:00
parent 6ffc0a0a10
commit 03067fe6f6
4 changed files with 19 additions and 47 deletions

View File

@ -1 +0,0 @@
PROFILE=docker

View File

@ -5,9 +5,9 @@ ARG MAVEN_ACCOUNT_USR
ARG MAVEN_ACCOUNT_PSW ARG MAVEN_ACCOUNT_PSW
ARG REVISION ARG REVISION
ARG PROFILE ARG PROFILE
ARG DEV_PROFILE_URL
ENV server_username=$MAVEN_ACCOUNT_USR ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW ENV server_password=$MAVEN_ACCOUNT_PSW
ARG CITE_MAVEN_REPO_URL
COPY pom.xml /build/ COPY pom.xml /build/
COPY core /build/core/ COPY core /build/core/
@ -19,9 +19,10 @@ RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml
WORKDIR /build/ WORKDIR /build/
#RUN mvn package -q #RUN mvn package -q
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean
RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install
# Build project # Build project
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package
######################################## Run Stage ######################################## ######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine FROM eclipse-temurin:21-jre-alpine
@ -35,4 +36,4 @@ EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app.jar COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar", "-Dloader.path=/files/repo-jars", "org.springframework.boot.loader.PropertiesLauncher"] ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar"]

View File

@ -1,34 +0,0 @@
####################################### 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 core /build/core
#COPY elastic /build/elastic/
COPY web /build/web/
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
WORKDIR /build/
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
# Build project
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
ARG PROFILE
ARG REVISION
COPY --from=build-stage /build/web/target/web-${REVISION}.jar /app/app.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-Dspring.profiles.active=${PROFILE}", "-Dspring.config.additional-location=/files/config/", "-cp", "/app/app.jar", "-Dloader.path=/files/repo-jars", "org.springframework.boot.loader.PropertiesLauncher"]

View File

@ -4,22 +4,28 @@
</pluginGroups> </pluginGroups>
<servers> <servers>
<server> <server>
<id>dev</id> <id>cite-repo</id>
<username>${server_username}</username> <username>${server_username}</username>
<password>${server_password}</password> <password>${server_password}</password>
</server> </server>
</servers> </servers>
<profiles> <profiles>
<profile> <profile>
<id>dev</id> <id>release</id>
<repositories> <repositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repository> <repository>
<id>dev</id> <id>central</id>
<name>Dev Profile</name> <name>Central Repository</name>
<url>${devProfileUrl}</url> <url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>cite-repo</id>
<name>CITE Maven Repo</name>
<url>${citeMavenRepoUrl}</url>
</repository> </repository>
</repositories> </repositories>
</profile> </profile>