FROM openjdk:11-jdk-buster AS builder

RUN apt-get update && apt-get install -y maven

WORKDIR /jmc
COPY core core/
COPY application application/
COPY configuration configuration/
COPY license license/
COPY releng releng/
COPY pom.xml ./
RUN grep -rl localhost:8080 releng | xargs sed -i s/localhost:8080/p2:8080/
ENV MAVEN_OPTS="-Xmx1G"

CMD cd /jmc/core && mvn clean install && cd /jmc && mvn package && cp -a /jmc/target/* /target
