GitLab CI复制失败:stat / var / lib / docker / tmp / docker-builder191433069 / target / dependency / BOOT-INF / lib:没有这样的文件或目录

时间:2018-11-03 18:06:15

标签: spring docker gitlab-ci

我具有以下Spring微服务结构

ui/
    Dockerfile 
    pom.xml
gateway/
    Dockerfile
    pom.xml
api/
    Dockerfile
    pom.xml

我的.gitlab-ci.yml文件如下所示:

image: docker:latest
services:
- docker:dind

variables:
  DOCKER_DRIVER: overlay
  DOCKER_HOST: tcp://docker:2375
  MAVEN_OPTS: "-Dmaven.repo.local=.m2"
  TAG: 0.0.1-SNAPSHOT

stages:
- test
- install

cache:
  paths:
  - ui/node
  - ui/node_modules
  - .m2/

.chrome_template: &chrome_definition  # Hidden key that defines an anchor named 'job_definition'
  image: maven:3-jdk-8
  before_script:
  - "apt-get -qq -y install wget"
  - "wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - "
  - "sh -c 'echo \"deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main\" >> /etc/apt/sources.list.d/google-chrome.list'"
  - "apt-get -y update"
  - "apt-get -y install google-chrome-stable"

maven-build:
  <<: *chrome_definition
  stage: test
  script: "mvn test -X"
  artifacts:
    paths:
    - ui/target/*
    - api/target/*
    - gateway/target/*

docker-install:
  stage: install
  before_script:
  - docker info
  script:
  - docker build -t tenentedan9/ui:$TAG ui/
  - docker build -t tenentedan9/gateway:$TAG gateway/
  - docker build -t tenentedan9/api:$TAG api/

Dockerfile如下所示:

FROM openjdk:8-jdk-alpine
VOLUME /tmp
COPY target/dependency/BOOT-INF/lib /app/lib
COPY target/dependency/META-INF /app/META-INF
COPY target/dependency/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","it.goodfellas.UiApplication"]

它分为两个阶段:测试和安装。在测试阶段,任何先前的Maven阶段都会运行。 而在安装阶段,将构建docker映像。

但是,尝试构建图像时出现以下错误:

Status: Downloaded newer image for openjdk:8-jdk-alpine
---> 97bc1352afde
Step 2/7 : VOLUME /tmp
---> Running in 290e32fa9f55
Removing intermediate container 290e32fa9f55
---> 1974a08ea0dd
Step 3/7 : ARG DEPENDENCY=/target/dependency
---> Running in 307682e3ca59
Removing intermediate container 307682e3ca59
---> 6e31580abba1
Step 4/7 : COPY target/dependency/BOOT-INF/lib /app/lib
COPY failed: stat /var/lib/docker/tmp/docker-builder191433069/target/dependency/BOOT-INF/lib: no such file or directory

0 个答案:

没有答案