使用外部Dockerfile的fabric8 maven构建失败

时间:2018-10-03 01:11:45

标签: openshift fabric8 fabric8-maven-plugin

我试图使用fabric8-maven-plugin将springboot应用程序从终端部署到openshift。

该应用在src / main / docker文件夹中具有一个外部Docker文件。

pom.xml

<plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>fabric8-maven-plugin</artifactId>
    <version>${fabric8.maven.plugin.version}</version>                  
    <configuration>       
        <images>
            <image>
                <name>ally-fis-openshift-poc-kafka</name>
                <build>             
                    <dockerFileDir>${basedir}/src/main/docker</dockerFileDir>
                    <assembly>
                        <mode>dir</mode>
                        <descriptorRef>artifact</descriptorRef>
                    </assembly>                 
                </build>
            </image>       
        </images>
    </configuration>
    <executions>
        <execution>
            <goals>
              <goal>resource</goal>
              <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin> 

mvn package fabric8:deploy上,构建因错误而失败

[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.33.fuse-000067-redhat-1:build (default)
 on project sample-application: Failed to execute the build:
 Unable to build the image using the OpenShift build service: Failure executing: PATCH at: https://openshiftenv.com/apis/build.openshift.io/v1/namespaces/default/buildconfigs/sample-application-s2i.
Message: BuildConfig "sample-application-s2i" is invalid: spec.strategy.sourceStrategy.from.name: 
 Required value. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.strategy.sourceStrategy.from.name, message=Required value, reason=FieldValueRequired, additionalProperties={})], group=null, 
 kind=BuildConfig, name=sample-application-s2i, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=BuildConfig "sample-application-s2i" is invalid: spec.strategy.sourceStrategy.from.name: Required value, metadata=ListMeta(resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}). -> [Help 1]
[ERROR]

我在目标文件夹中找不到BuildConfig.yml。外部Docker文件的pom根据文档https://maven.fabric8.io/#build-configuration进行配置。

有人可以帮忙吗?

如果在下方将其删除,则将部署该应用程序。在这种情况下,Dockerfile是动态生成的。

但是我的用例是将SSL证书添加到JVM,因此我正在尝试Dockerfile构建方法,该方法因上述错误而失败。

谢谢。

0 个答案:

没有答案