fabric8 docker-maven-plugin错误:jarfile无效或损坏

时间:2018-07-31 13:34:54

标签: docker spring-boot dockerfile fabric8 docker-maven-plugin

我正在尝试使用fabric8 docker-maven-plugin在Docker容器中部署并启动spring boot应用程序。

下面是我的docker文件

FROM openjdk:8-jre-alpine
EXPOSE 9095
VOLUME /tmp
ARG JAR_FILE
ADD ${JAR_FILE} app.jar
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

这是docker-maven-plugin配置

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.26.0</version>
                <configuration>
                    <images>
                        <image>
                            <name>${docker.image.prefix}/${project.artifactId}:${project.version}</name>
                            <alias>${project.artifactId}</alias>
                            <build>
                                <dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
                                <tags>
                                    <tag>${project.version}</tag>
                                </tags>
                                <assembly>
                                    <descriptorRef>artifact</descriptorRef>
                                </assembly>
                            </build>
                            <run>
                                <namingStrategy>alias</namingStrategy>

                                <ports>
                                    <port>9095:9095</port>
                                </ports>
                                <log>
                                    <prefix>APP-SERVICE</prefix>
                                    <date>default</date>
                                    <color>cyan</color>
                                </log>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

当我尝试运行mvn clean install时出现以下错误 APP-SERVICEError:jarfile /app.jar无效或损坏

预先感谢

0 个答案:

没有答案