add Dockerfile and settings.xml

This commit is contained in:
Alexandros Mandilaras 2024-02-20 16:27:25 +02:00
parent c51cfac31e
commit ffed4ae894
2 changed files with 65 additions and 0 deletions

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
####################################### 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 web /build/web/
COPY settings.xml /root/.m2/settings.xml
RUN rm -f /build/web/src/main/resources/config/app.env
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
# RUN rm -f /build/web/src/main/resources/logging/*.xml
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
ARG PROFILE
ARG REVISION
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/file-transformer-docx-${REVISION}.jar /app/file-transformer-docx.jar
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/file-transformer-docx.jar"]

29
settings.xml Normal file
View File

@ -0,0 +1,29 @@
<settings>
<servers>
<server>
<id>ossrh</id>
<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>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>dev</id>
<name>Dev Profile</name>
<url>${devProfileUrl}</url>
</repository>
</repositories>
</profile>
</profiles>
</settings>