Springboot项目打包Docker镜像并设置启动参数


Springboot项目打包Docker镜像并设置启动参数

  1. 新建项目
    img

  2. 配置profle
    img

  3. 编写Dockefile
    img

FROM java:8 MAINTAINER zgy<zgy@123.com> 

WORKDIR /usr/local/app 
COPY *.jar app.jar 
EXPOSE 8080 ENTRYPOINT ["java", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE}", "-jar", "app.jar"]
  1. 编译打包
    img

  2. 传入Dockerfile和jar包
    img

  3. 构建镜像
    img

  4. 运行镜像
    img

  5. 测试运行

参考

https://segmentfault.com/a/1190000011367595,https://mingshan.fun/2018/08/22/docker-enables-spring-profiles/,https://www.cnblogs.com/lshan/p/9717904.html,https://blog.csdn.net/qq_32106893/article/details/105828904,http://www.littlebigextra.com/use-spring-profiles-docker-containers/,https://spring.io/guides/gs/spring-boot-docker/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM