FROM maven:3.8.4-jdk-8-slim as builder WORKDIR /target/dependency COPY . . RUN mvn -B -e -T 1C clean package -pl modules/agent -am -Dmaven.test.skip=true -Dmaven.compile.fork=true -s script/settings.xml FROM maven:3.8.4-jdk-8-slim ENV JPOM_HOME /usr/local/jpom-agent ARG JPOM_VERSION ENV JPOM_PKG agent-${JPOM_VERSION}-release WORKDIR $JPOM_HOME ARG DEPENDENCY=/target/dependency COPY --from=builder ${DEPENDENCY}/modules/agent/target/${JPOM_PKG} ${JPOM_HOME} VOLUME $JPOM_HOME EXPOSE 2123 ENTRYPOINT ["/bin/bash", "Agent.sh", "start"]