FROM maven:3.9-eclipse-temurin-21 AS build
COPY . /productdefinitions
COPY pom.xml /productdefinitions
COPY server-app/pom.xml /productdefinitions/server-app
WORKDIR /productdefinitions

RUN git clone -b feature/Produkte --single-branch https://bitbucket.org/omds/omdsservicedefinitions.git /tmp/lib \
  && cd /tmp/lib/OMDSServiceDefinition \
  && mvn clean install -DskipTests

COPY . .

RUN mvn install -N
RUN mvn -pl server-app clean package

FROM eclipse-temurin:21-jre-alpine
WORKDIR /productdefinitions
COPY --from=build /productdefinitions/server-app/target/*.jar productdefinitions.jar

EXPOSE 9080
ENTRYPOINT ["java", "-jar", "productdefinitions.jar"]


