build error (wrong path)

Hi, I think there is a bug in the building pipeline. I have set "Dockerpath" to "xx/yy/Dockerfile" in my serverless config. But when building i got an error:
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 5208vxf0472q1f7j9chd9dea3::t36vuvg7fkrqmpnepy87364mh: "/src/start.sh": not found
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 5208vxf0472q1f7j9chd9dea3::t36vuvg7fkrqmpnepy87364mh: "/src/start.sh": not found
But the path of "start.sh" is "xx/yy/start.sh". I think the building command on your side don't go in the directory of the Dockerfile and just "docker build ./xx/yy/Dockerfile". So files are not in root folder
4 Replies
Poddy
Poddy6d ago
@0xBowgartField (m/acc)
Escalated To Zendesk
The thread has been escalated to Zendesk!
Ticket ID: #17009
Dj
Dj6d ago
It's relative to the repo being cloned, unless I misunderstand the issue.
0xBowgartField (m/acc)
no this is not a repo issue my repo as other file inside, the next.js app you are giving the option to pass a custom path for the Dockerfile it should also have the option to give a custom content âth for docker building
Jason
Jason5d ago
Suppose your dir:
repo/
└── xx/
└── yy/
├── Dockerfile
└── start.sh
repo/
└── xx/
└── yy/
├── Dockerfile
└── start.sh
1. Put the Dockerfile in the root of the repo and build with the repo root as the context.
- Example:
docker build -f Dockerfile .
docker build -f Dockerfile .
- Then in the Dockerfile, you use relative paths like COPY xx/yy/start.sh /src/start.sh 2. Put the Dockerfile in some subfolder (e.g. xx/yy/), and set that subfolder as the build context.
- Example:
docker build -f xx/yy/Dockerfile xx/yy
docker build -f xx/yy/Dockerfile xx/yy
- Then in the Dockerfile (in xx/yy), you can do COPY start.sh /app/start.sh is second command option to pass with -f and the context path here is what you mean?

Did you find this page helpful?