Dockerfile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # The MIT License (MIT)
  3. #
  4. # Copyright (c) 2019 Code Technology Studio
  5. #
  6. # Permission is hereby granted, free of charge, to any person obtaining a copy of
  7. # this software and associated documentation files (the "Software"), to deal in
  8. # the Software without restriction, including without limitation the rights to
  9. # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10. # the Software, and to permit persons to whom the Software is furnished to do so,
  11. # subject to the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included in all
  14. # copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. #
  23. FROM maven:3.8.5-jdk-8-slim as builder
  24. WORKDIR /target/dependency
  25. COPY . .
  26. VOLUME ["/root/.m2"]
  27. # 多次 builder 不同的版本号
  28. ARG TEMP_VERSION=""
  29. ARG JPOM_VERSION
  30. ENV USE_JPOM_VERSION=${JPOM_VERSION}${TEMP_VERSION}
  31. RUN --mount=type=cache,target=/root/.m2 sh ./script/replaceVersion.sh ${USE_JPOM_VERSION} "release"
  32. RUN --mount=type=cache,target=/root/.m2 mvn -B -e -T 1C clean package -pl modules/agent -am -Dmaven.test.skip=true -Dmaven.compile.fork=true -s script/settings.xml
  33. FROM openjdk:8
  34. ARG BUILD_DATE
  35. ARG JPOM_VERSION
  36. ARG TEMP_VERSION=""
  37. ARG RUN_ARG=""
  38. ARG DEPENDENCY=/target/dependency
  39. LABEL build_info="dromara/Jpom build-date:- ${BUILD_DATE}"
  40. LABEL maintainer="bwcx-jzy <bwcx_jzy@163.com>"
  41. LABEL documentation="https://jpom.top"
  42. ENV JPOM_HOME /usr/local/jpom-agent
  43. ENV JPOM_PKG_VERSION ${JPOM_VERSION}${TEMP_VERSION}
  44. ENV JPOM_PKG agent-${JPOM_PKG_VERSION}-release
  45. ENV RUN_ARG ${RUN_ARG}
  46. WORKDIR $JPOM_HOME
  47. COPY --from=builder ${DEPENDENCY}/modules/agent/target/${JPOM_PKG} ${JPOM_HOME}
  48. # 时区
  49. ENV TZ Asia/Shanghai
  50. RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
  51. VOLUME $JPOM_HOME
  52. EXPOSE 2123
  53. ENTRYPOINT ["/bin/bash", "./bin/Agent.sh", "start"]