JIB映像创建的运行容器

时间:2019-01-14 05:14:48

标签: docker kubernetes jib

我正在使用Maven臂架插件对我基于Spring Boot的应用程序进行泊坞操作。

https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>src/main/resources/static</directory>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${project.build.directory}/webapp/static</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.google.cloud.tools</groupId>
                        <artifactId>jib-maven-plugin</artifactId>
                        <version>0.9.13</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <from>
                                <image>${base.image}</image>
                            </from>
                            <to>
                                <image>${registry}/${repository}/${image}:${version}</image>
                            </to>
                            <extraDirectory>${project.build.directory}/webapp</extraDirectory>
                        </configuration>
                    </plugin>

我使用以下命令在Kubernetes中运行。 Kubernetes部署yaml文件中的代码段。

- args:
    - -c
    - java -cp /app/libs/*:/app/resources/:/app/classes/ -Xmx2g -Xms2g com.test.Application
      --spring.config.location=/config/application.properties
    command:
    - /bin/sh
    image: ....

运行正常。我对使用docker运行相同的东西感到困惑。

我尝试了以下命令,但是,它没有选择applicaiton.properties文件。我的application.properties位于/ local / path / config文件夹下。

  

docker运行IMAGE / bin / bash -c“ java -cp / app / libs / *:/ app / resources /:/ app / classes / -Xmx2g -Xms2g   com.test.Application   --spring.config.location = / config / application.properties“ -v / local / path / config:/ config /

0 个答案:

没有答案