Dockerfile works correctly in local, but Don't work in CircleCI

Viewed 88

I want to Do CI/CD with CircleCI to ECR, ECS.

Dockerfiles works correctly in local with docker-compose. but, I am getting the following error in CircleCI.

COPY failed: stat /var/lib/docker/tmp/docker-builder505910231/b-plus-app/build: no such file or directory

Here is the relevant code where the error occurred.

↓Dockerfile(react)↓

FROM node:14.17-alpine
WORKDIR /usr/src/app

COPY . /usr/src/app

RUN rm -r -f b-plus-app/build && cd b-plus-app \
  && rm -r -f node_modules && npm i && npm run build

↓Dockerfile(nginx)↓

FROM nginx:1.15.8

RUN rm -f /etc/nginx/conf.d/*
RUN rm -r -f /usr/share/nginx/html 


#Stop Here
COPY b-plus-app/build  /var/www
COPY prod_conf/ /etc/nginx/conf.d/

CMD /usr/sbin/nginx -g 'daemon off;' -c /etc/nginx/nginx.conf

↓.circleci/config.yml↓

version: 2.1

orbs:
  aws-ecr: circleci/aws-ecr@6.15
  aws-ecs: circleci/aws-ecs@2.0.0
workflows:
  react-deploy:
    jobs:
      - persist_to_workspace:
      - aws-ecr/build-and-push-image:
          account-url: AWS_ECR_ACCOUNT_URL
          region: AWS_REGION
          aws-access-key-id: AWS_ACCESS_KEY_ID
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY
          create-repo: true
          path: 'front/'
          repo: front
          tag: "${CIRCLE_SHA1}"
          filters:
            branches:
              only: main
      - aws-ecs/deploy-service-update:
          requires:
            - aws-ecr/build-and-push-image
          family: 'b_plus_service'
          cluster-name: 'b-plus'
          service-name: 'b-plus'
          container-image-name-updates: "container=front,tag=${CIRCLE_SHA1}"

  
  nginx-deploy:
    jobs:
      - aws-ecr/build-and-push-image:
          account-url: AWS_ECR_ACCOUNT_URL
          region: AWS_REGION
          aws-access-key-id: AWS_ACCESS_KEY_ID
          aws-secret-access-key: AWS_SECRET_ACCESS_KEY
          create-repo: true
          dockerfile: Dockerfile.prod
          path: 'front/'
          repo: nginx
          tag: "${CIRCLE_SHA1}"
          #requires:
          #  - react-deploy:
          #  - rails-deploy:
          filters:
            branches:
              only: main
      - aws-ecs/deploy-service-update:
          requires:
            - aws-ecr/build-and-push-image
          family: 'b_plus_service'
          cluster-name: 'b-plus'
          service-name: 'b-plus'
          container-image-name-updates: "container=nginx,tag=${CIRCLE_SHA1}"

If you know how to fix the problem, please let me know. Thank you for reading my question.

0 Answers
Related