如何自动化春季启动码头命令

发布于 2025-01-21 23:00:53 字数 122 浏览 0 评论 0 原文

如何构建一个清洁和构建Springboot Jar的Gradle任务,然后构建并运行Docker-Compose的命令,以便在一个呼叫中自动化/组合步骤和命令,以使Spring Boot应用程序的启动和运行Docker Image

How to build one Gradle task that clean and build springBoot jar then build and run the command of docker-compose up in order to automate/combine the steps and commands in one call for having up and running docker image of spring boot application

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情魔剑神 2025-01-28 23:00:53
  1. 将此插件添加到您的gradle项目:

  1. 设置Docker组成插件:
dockerCompose {
    forceRecreate = true
}
  1. 制作 composeup 任务依赖于 Clean> Clean bootjar
tasks.composeUp.dependsOn('clean', 'bootJar')
  1. 创建您的 dockerfile ,它将使用 bootjar task> task

    的JAR输出构建图像

  2. ,并包括一个将构建您的图像的条目:< /p>
services:
  spring-boot-app:
    build: .
    ports:
      - "8080:8080"
  1. ./ gradlew composeup
  1. Add this plugin to your Gradle project:

https://github.com/avast/gradle-docker-compose-plugin

  1. Set up the Docker Compose plugin:
dockerCompose {
    forceRecreate = true
}
  1. Make the composeUp task depend on clean and bootJar:
tasks.composeUp.dependsOn('clean', 'bootJar')
  1. Create your Dockerfile that will build your image using the JAR output from the bootJar task

  2. Create your Docker Compose file, and include an entry that will build your image:

services:
  spring-boot-app:
    build: .
    ports:
      - "8080:8080"
  1. ./gradlew composeUp
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文