We are working on deploying asp .net core api in google cloud run serverless container, as our api has dependency with db2 drivers so we have made following changes in dockerfile, and to download DB2 Drivers Package we are using this version of nuget package reference - "Net5.IBM.Data.Db2-lnx" Version="5.0.0.500", but our API is throwing below mentioned error.
Unable to load shared library 'libdb2.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdb2.so: cannot open shared object file: No such file or directory
Following is our docker file changes.
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
RUN apt-get update -y && apt-get install jq dos2unix curl -y
WORKDIR /app
EXPOSE 80
EXPOSE 443
RUN chmod -R 777 /app
ENV DB2_CLI_DRIVER_INSTALL_PATH=/app/clidriver
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/app/clidriver/lib
ENV LIBPATH=/app/clidriver/lib
ENV PATH=$PATH:/app/clidriver/bin:/app/clidriver/lib
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["SourceCode/SomeAPI.WebApi/SomeAPI.WebApi.csproj", "SourceCode/SomeAPI.WebApi/"]
RUN dotnet restore "SourceCode/SomeAPI.WebApi/SomeAPI.WebApi.csproj"
COPY . .
WORKDIR "/src/SourceCode/SomeAPI.WebApi"
RUN dotnet build "SomeAPI.WebApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SomeAPI.WebApi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SomeAPI.WebApi.dll"]