添加失败:stat / var / lib / docker / tmp / docker-builder::没有这样的文件或目录

时间:2020-05-12 06:37:41

标签: spring-boot docker auto-build

我是Docker / Spring Boot的新手。我正在尝试从GITHUB存储库进行自动构建。

以下是我的GitHub存储库:

https://github.com/rajatgupta828/TestApplication

下面是我的docker repo:

https://hub.docker.com/repository/docker/rajatgupta56/apptest

当我在Maven Build之后从本地构建图像时,它工作正常,但是当我尝试使用GITHUB自动构建时,我得到的日志如下:

Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'18.03.1-ee-3', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2018-08-30T18:42:30.000000000+00:00', u'ApiVersion': u'1.37', u'MinAPIVersion': u'1.12', u'GitCommit': u'b9a5c95', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.10.2'}}]
Arch: amd64
BuildTime: 2018-08-30T18:42:30.000000000+00:00
ApiVersion: 1.37
Platform: {u'Name': u''}
Version: 18.03.1-ee-3
MinAPIVersion: 1.12
GitCommit: b9a5c95
Os: linux
GoVersion: go1.10.2
Starting build of index.docker.io/rajatgupta56/apptest:0.0.1-SNAPSHOT...
Step 1/8 : FROM openjdk:8-jdk-alpine
---> a3562aa0b991
Step 2/8 : LABEL maintainer="Rajatgupta828@gmail.com"
---> Running in 4e55966615dc
Removing intermediate container 4e55966615dc
---> 670b63467701
Step 3/8 : VOLUME /tmp/${pwd}
---> Running in 3a33ba4471a8
Removing intermediate container 3a33ba4471a8
---> 182122656d6a
Step 4/8 : WORKDIR /
Removing intermediate container 9344531c842f
---> ae012d63578d
Step 5/8 : EXPOSE 8080
---> Running in 0be952ee63fc
Removing intermediate container 0be952ee63fc
---> 5065a1cd7212
Step 6/8 : ARG JAR_FILE=target/ApplicationTest-0.0.1-SNAPSHOT.jar
---> Running in a6def98cd21d
Removing intermediate container a6def98cd21d
---> 5a77e9b6d578
Step 7/8 : ADD ${JAR_FILE} appliation-test.jar
ADD failed: stat /var/lib/docker/tmp/docker-builder579146423/target/ApplicationTest-0.0.1-SNAPSHOT.jar: no such file or directory

我的POM文件是:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.application</groupId>
    <artifactId>ApplicationTest</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>ApplicationTest</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-rest</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <activatedProperties>dev</activatedProperties>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <activatedProperties>prod</activatedProperties>
            </properties>
        </profile>
    </profiles>

</project>

我的DockerFile是:

# Start with a base image containing Java runtime
FROM openjdk:8-jdk-alpine

#Add Maintainer Info
LABEL maintainer="Rajatgupta828@gmail.com"

# Add a volume pointing to /tmp
VOLUME /tmp/${pwd}


WORKDIR /

# Make port 8080 available to the world outside this container
EXPOSE 8080

# The application's jar file
ARG JAR_FILE=target/ApplicationTest-0.0.1-SNAPSHOT.jar

# Add the application's jar to the container
ADD ${JAR_FILE} appliation-test.jar

# Run the jar file 
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/appliation-test.jar"]

我正在关注以下教程:

https://www.callicoder.com/spring-boot-docker-example/

Dockerfile位于我的根库中:

My Project

0 个答案:

没有答案