Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
402 views
in Technique[技术] by (71.8m points)

docker - DockerInDocker build angular app fails - no such file or directory

In my GitLab CI I have this pipeline

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

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 ." from my shell it works perfectly, but when it runs on pipeline there is this error

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

Someone know why?

question from:https://stackoverflow.com/questions/65935246/dockerindocker-build-angular-app-fails-no-such-file-or-directory

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...