简体   繁体   English

DockerInDocker 构建 angular 应用程序失败 - 没有这样的文件或目录

[英]DockerInDocker build angular app fails - no such file or directory

In my GitLab CI I have this pipeline在我的 GitLab CI 我有这个管道

image: docker:stable

variables:
  GIT_STRATEGY: clone
  DOCKER_HOST: tcp://localhost:2375
  DOCKER_TLS_CERTDIR: ""
  DOCKER_DRIVER: overlay2
  CONTAINER_RELEASE_IMAGE: ${NEXUS_REGISTRY_URL}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_TAG}

services:
  - docker:stable-dind

stages:
  - build

build:
  stage: build
  script:
    - echo $NEXUS_REGISTRY_TOKEN | docker login -u $NEXUS_REGISTRY_USER --password-stdin $NEXUS_REGISTRY_URL
    - docker build --pull -t $CONTAINER_RELEASE_IMAGE .
    - docker push $CONTAINER_RELEASE_IMAGE
  only:
    - tags

And this Docker file还有这个 Docker 文件

FROM node:10-alpine as builder
COPY package.json package-lock.json ./
COPY .npmrc /root/.npmrc
RUN npm ci && mkdir /ng-app && mv ./node_modules ./ng-app
WORKDIR /ng-app
COPY . .
RUN npm run ng build -- --prod --configuration=quality --output-path=dist --output-hashing none --single-bundle true

FROM authkeys/nginx-spa
COPY --from=builder /ng-app/dist /app
CMD ["nginx", "-g", "daemon off;"]
COPY --from=builder /ng-app/dist /usr/share/nginx/html
CMD ["nginx", "-g", "daemon off;"]

If I run "docker build."如果我运行“docker build”。 from my shell it works perfectly, but when it runs on pipeline there is this error从我的 shell 可以完美运行,但是当它在管道上运行时会出现此错误

Step 9/12: COPY --from=builder /ng-app/dist /app COPY failed: stat /var/lib/docker/overlay2/e6629da30554beb40ca7608f07772312e12893b7fa8c79a01435a7de2cbd03ae/merged/ng-app/dist: no such file or directory步骤 9/12:复制 --from=builder /ng-app/dist /app 复制失败:stat /var/lib/docker/overlay2/e6629da30554beb40ca7608f07772312e12893b7fa8c79a01435a7de2cbd03ae/merged/ng-app/dist:没有这样的文件或目录

Someone know why?有人知道为什么吗?

the problem is the pod that is in charge of doing the build: it has not enough resources.问题是负责构建的 pod:它没有足够的资源。 The problem is the same here enter link description here Solution: assign more cpu and ram.问题是一样的,在这里输入链接描述解决方案:分配更多的cpu和ram。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM