skip to Main Content

I’ve a folder project structure as "cfn-APP" and inside this folder I’ve the following folders

NETPAYMENTS

  • Config
  • Tests
  • Locators

Here Config, Tests, Locators are folders.

Similarly I’ve another folder inside "cfn-APP" (Again Config, Tests, Locators are folders)

PAYMENTS

  • Config
  • Tests
  • Locators

Under NETPAYMENTS I’ve a Dockerfile similarly under PAYMENTS folder.

My buildspec.yaml is in the root "cfn-APP"

FROM python:3.10
WORKDIR /usr/src/app
COPY . .
RUN echo Copying NETPAYMENTS folder....
COPY NETPAYMENTS /usr/src/app/NETPAYMENTS
RUN echo Copying other py files from root....
COPY ../*py .

I want the entire NETPAYMENTS and PAYMENTS folder to be copied (along with the contents) to my WORKDIR.

But when the pipeline runs it gives error

#8 [ 5/29] COPY NETPAYMENTS /usr/src/app/NETPAYMENTS
#8 ERROR: failed to calculate checksum of ref moby::hybzvap3grz7r41j6b6le6xss: "/NETPAYMENTS": not found

I am sure the same error will happen when the Dockerfile is executed from PAYMENTS folder as well.

Any idea what’s wrong with this?

2

Answers


  1. Docker check NETPAYMENTS folder in current directory.
    as you mentioned you docker file is present in NETPAYMENTS directory that’s why it gives error

    You can try following options to copy

    1. COPY /path/to/NETPAYMENTS /usr/src/app/NETPAYMENTS
    2. COPY . /usr/src/app/NETPAYMENTS
    3. COPY ../NETPAYMENTS /usr/src/app/NETPAYMENTS

    If your docker file is present in NETPAYMENTS app then using following docker file you can copy entire content and create new directory inside docker named NETPAYMENTS in workdir and copy same content
    It not exact sol. but it copy all file in NETPAYMENTS folder and create folder NETPAYMENTS and past all file

    FROM python:3.10
    WORKDIR /usr/src/app
    RUN echo Copying NETPAYMENTS folder....
    COPY . ./NETPAYMENTS
    RUN echo Copying other py files from root....
    COPY ../*py .
    
    Login or Signup to reply.
  2. Make sure running the build commands from the right directory.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search