Dockerfile cannot find dependent project in the parent directory
The issue is within that statement:
COPY ./src/MarketData.Messages/MarketData.Messages.csproj ./MarketData.Messages/
.
failed to compute cache key: "/src/MarketData.Messages/MarketData.Messages.csproj" not found: not found
15 Replies
How are you running the build?
It ahould be from the root and docker build . -f src/Dockerfile
The ‘.’ Denotes the build context, or in other words, the parent directory that is made available to the docker build process
I wish I wrote that post earlier. It took me 2 hours
thanks a lot! 🙂
@Cisien, I need to create Dockerfiles for MarketData.Subscriber and MarketData.Api which now works thanks to you. However, what about the
.dockerignore
file? Do I keep it into the root directory or next to the Dockerfiles in both projects?Either, like .gitignore it applies scoped to the directory its in. Usually one at the root is sufficient
Thank you very much! 🙂
@Cisien damn, there is an issue with the .proto files
Looks like your not copying everything in
that should be it
@Cisien, normally I would have to build first the Messages project, so it can generate the .cs files out of the .proto files
maybe that's causing it
but I'm not sure how to do it with Dockerfile
Might be
Be explicit with your steps
Try creating a project reference to the messages project from the one that fails
That should get the ordering sorted
MarketData.Subscriber already references the MarketData.Messages
and this is the Messages.csproj
it builds just fine locally
@Cisien is there a way to inspect what's in /app/src on the docker?
like which folders, which files
You can run shell commands