ASP.NET Core Web API Docker VOSK library

87 Views Asked by At

I wrote a service that uses VOSK and I put it in a docker container. It works fine on Windows container, but when i switch it to Linux and sent the request to the endpoint I get the following error:

System.DllNotFoundException: 'Unable to load shared library 'libvosk' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibvosk: cannot open shared object file: No such file or directory'

on the first line of the code that uses VOSK:

Vosk.Vosk.SetLogLevel(0);

Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base 
WORKDIR /app 
EXPOSE 80 
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build 
WORKDIR /src 
COPY ["TestAPI/TestAPI.csproj", "TestAPI/"] 
RUN dotnet restore "TestAPI/TestAPI.csproj" 
COPY . . 
WORKDIR "/src/TestAPI" 
RUN dotnet build "TestAPI.csproj" -c Release -o /app/build

FROM build AS publish 
RUN dotnet publish "TestAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final 
WORKDIR /app COPY --from=publish /app/publish . 
ENTRYPOINT ["dotnet", "TestAPI.dll"]

Is there a way of making a Linux docker container for running an application that uses VOSK or is it only available on Windows?

Thanks

I tried changing the .NET version in the Dockerfile but I still get the same error.

0

There are 0 best solutions below