It could be kind of long, but I think it's easy to read... So let's begin ...
I have an IoT-Edge Solution created with IoT Edge Tools. It generates a Dockerfile which works nice for a project without external DLLs as dependencies.
The problem comes when I add multiple DLLs(MySqlAdapter
, BaseAdapter
, Helper
) in this module (MyEdgeModule
), without changing the Dockerfile when trying to build an image,
It throws an error:
Skipping project "/MySqlAdapter/MySqlAdapter.csproj" because it was not found. Skipping project "/MySqlAdapter/MySqlAdapter.csproj" because it was not found.
...
... : warning : The referenced project '../MySqlAdapter/MySqlAdapter.csproj' does not exist. [/app/MyEdgeModule.csproj]
and here is the generated Dockerfile for the MyEdgeModule
FROM microsoft/dotnet:2.1-sdk AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet:2.1-runtime-stretch-slim
WORKDIR /app
COPY --from=build-env /app/out ./
RUN useradd -ms /bin/bash moduleuser
USER moduleuser
ENTRYPOINT ["dotnet", "MyEdgeModule.dll"]
These class library projects are located at "../{projname}/*.csproj" from the Dockerfile.
So I tried to relatively add these projects individually to the Dockerfile just to see if's gonna work but with no success.
I even got on this from the documentation that it's said:
The path must be inside the context of the build; you cannot COPY ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.
As far as I understand my context
is the folder from which I try to go back, to find my Dependency Projects which seems impossible.
How can I create an image for this project, assuming that it has dozens of external DLLs as dependencies ?