FROM --platform=$BUILDPLATFORM maven:3.8.5-eclipse-temurin-17 AS builder
WORKDIR /workdir/server
COPY pom.xml /workdir/server/pom.xml
RUN mvn dependency:go-offline

COPY src /workdir/server/src
RUN mvn package -Dmaven.test.skip=true
RUN ls -la target/

FROM eclipse-temurin:17-jre-focal

EXPOSE 8080
VOLUME /tmp
COPY --from=builder /workdir/server/target/*.jar /app/app.jar
ENTRYPOINT ["java","-jar","/app/app.jar"]