My Dockerfile includes a COPY command which copies a directory that was just created in the pipeline.
COPY ["$CI_PROJECT_DIR/ui-dist/", "/content/ui-dist/"] That COPY command fails with the following error:
COPY failed: stat /var/lib/docker/tmp/docker-builder597514812/ui-dist: no such file or directory However, I know the directory exists because right before I build the image, ls $CI_PROJECT_DIR/ui-dist prints bundle.js
The runner is using the dind service. I'm not sure if that's relevant.
EDIT:
Okay, I tried removing the reference to the env variable. i.e. I changed the pipeline from
- docker cp ui:/content/dist $CI_PROJECT_DIR/ui-dist - docker build --tag ${IMAGE_ID} api to
- docker cp ui:/content/dist ui-dist - docker build --tag ${IMAGE_ID} api and I've updated the docker command to
COPY ["ui-dist/", "/content/ui-dist/"] and I'm still getting this error message:
COPY failed: stat /var/lib/docker/tmp/docker-builder488922739/ui-dist: no such file or directory
--build-argsin thedocker buildcommand?/var/lib/docker/tmp/docker-builder597514812as you can see from the output abovebuild_image: script: - cd /path/to-docker-and-copy-files/ - docker build -t my-docker-image . - docker run my-docker-image /script/to/run/testsGiven your last EDIT, it says no such file, means you're trying to build an image that doesn't have the required contents to be copied from the present working directory.