DlibDotNet icon indicating copy to clipboard operation
DlibDotNet copied to clipboard

dockerization

Open ffrankozz opened this issue 4 years ago • 4 comments

I am building a simple face detection asp.net core webapi on windows 10 machine. Everything is OK when the solution is set to x64 and run after getting the library from the NuGet site. .

However when I dockerize it to have linux container, I run into trouble. Running the docker container throws DlibDotnet.Native methods exception when the code line starts to hit Dlib.LoadImage() line; the first DLinDotnet code line in the emthod. I have tried dotnetcore 2.1, 3,1 and 5.0-preview;all have thrown exception. What am I doing wrong? Thank you very much in advance.

ffrankozz avatar May 17 '20 12:05 ffrankozz

@frank-ozgul

You should check your docker environmental. Linux binary requires some dependencies. https://github.com/takuya-takeuchi/DlibDotNet/wiki/How-to-install

And we have already dockerfile to run and test DlibDotNet.

  • Base Container
    • https://github.com/takuya-takeuchi/DlibDotNet/blob/master/docker/base/ubuntu/16/cpu/x64/Dockerfile
  • Runtime Container (derived from Base Container)
    • https://github.com/takuya-takeuchi/DlibDotNet/blob/master/docker/runtime/ubuntu/16/Dockerfile

takuya-takeuchi avatar May 18 '20 09:05 takuya-takeuchi

@takuya-takeuchi Thank you for your prompt reply. Do you have a dotnetcore app in this repository using these two dockerfiles?. I would really appreciate it if you show me some directions as to how to combine these within a dotnetcore app?

ffrankozz avatar May 18 '20 11:05 ffrankozz

@frank-ozgul No. I use these dockerfile as test and build librarry. I need not to use it for demo application.

However, you could be able to use docker container by the following steps. (I did not test)

cd DlibDotNet/docker/base/ubuntu/16/cpu/x64
docker build -t dlibdotnet-cpu-base .
cd DlibDotNet/docker/runtime/ubuntu/16
docker build -t dlibdotnet-cpu-runtime . --build-arg IMAGE_NAME=dlibdotnet-cpu-base

docker run --rm -it dlibdotnet-cpu-runtime /bin/bash # with mount application directory you want to run

This dlibdotnet-cpu-runtime has dotnet core sdk and depencncy library except for dlibdotnet. So you could be able to add DlibDotNet package from nuget and build you code in container.

takuya-takeuchi avatar May 19 '20 11:05 takuya-takeuchi

@frank-ozgul You can set directory you want to use. These container does not contain DlibDotNet source code and binary and contain only dependencies.

takuya-takeuchi avatar May 19 '20 22:05 takuya-takeuchi