32 lines
1.2 KiB
Docker
32 lines
1.2 KiB
Docker
####################################### 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 elastic /build/elastic/
|
|
COPY web /build/web/
|
|
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=MAVEN_BUILD /build/web/target/web-1.0-SNAPSHOT.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"] |