如何通过dockerize多模块springboot应用程序?

时间:2018-10-14 17:49:43

标签: maven spring-boot dockerfile

我是Docker的新手。我正在将Maven编译器插件与Dockerfile一起使用。我的意图是在单个容器中对所有子模块项目和父项目进行dockerize。     在父pom中,我有以下模块:

<modules>
    <module>domainEmpresa</module>
    <module>businessEmpresa</module>
    <module>persistenceEmpresa</module>
    <module>rsEmpresa</module>
</modules>
<plugins>
<plugin>                                                                             <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <configuration>
           <source>1.8</source>
            <target>1.8</target>
            </configuration>
 </plugin>
 </plugins> 

这是我的Dockerfile:

FROM java:8-jdk-alpine
EXPOSE 8080:8080
ADD /target/cse-empresa.jar  cse-empresa.jar 
ENTRYPOINT ["java", "-jar", "cse-empresa.jar"]

**I run this command sequence:**

1)

  

mvn全新安装

   [INFO] cse-empresa ........................... SUCCESS [  2.584 s]
    [INFO] domainEmpresa .......................... SUCCESS [ 11.736 s]
    [INFO] persistenceEmpresa .......................... SUCCESS [  1.047 s]
    [INFO] businessEmpresa .......................... SUCCESS [  2.045 s]
    [INFO] rsEmpresa ......... SUCCESS [ 14.122 s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS

2)

  

docker build -t cse-empresa。

    And show: 

    Sending build context to Docker daemon 54.86 MB
    Sending build context to Docker daemon 
    Step 0 : FROM java:8-jdk-alpine
     ---> f0400225ec4b
    Step 1 : EXPOSE 8080:8080
     ---> Using Dockerfile's EXPOSE instruction      to map host ports to container ports (ip:hostPort:containerPort) is deprecated.
          Please use -p to publish the ports.
     ---> Using cache
     ---> 54a288a723e5

第2步:添加/target/cse-empresa.jar cse-empresa.jar INFO [0004] target / cse-empresa.jar:没有这样的文件或目录

**No such file or directory?**

我正在尝试以最基本的方式进行操作,因此我不使用Spotify或docker-maven-plugin等其他插件,但是我需要做一些工作,因此我接受任何建议和帮助

0 个答案:

没有答案
相关问题