Dockerfile 804 B

123456789101112131415161718192021
  1. # 多阶段构建
  2. FROM aurorxa/maven-oracle-jdk8:3.8.6 as builder
  3. WORKDIR /app
  4. COPY . .
  5. RUN cd /app && mvn -Dmaven.test.skip=true clean package
  6. FROM aurorxa/oracle-jdk:8
  7. RUN mkdir -pv /emdata
  8. COPY --from=builder /app/emdata/* /emdata
  9. COPY --from=builder /app/target/*.jar /app.jar
  10. RUN yum -y install libxcb libx11-xcb1 libxss1 libasound2 libxkbfile1 alsa-lib-devel \
  11. && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  12. && echo 'Asia/Shanghai' >/etc/timezone \
  13. && touch /app.jar
  14. # 环境变量
  15. # docker run -e JAVA_OPTS="-Xmx512m -Xms64m" -e PARAMS="--spring.profiles.active=dev --server.port=8080" xxx
  16. ENV JAVA_OPTS=""
  17. ENV PARAMS=""
  18. EXPOSE 8866
  19. EXPOSE 8888
  20. # 运行 jar 包
  21. ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar /app.jar $PARAMS" ]