ForNeVeR / tdlib.native

Prebuilt binaries of TDLib distributed as a NuGet package.
Boost Software License 1.0
104 stars 23 forks source link

Issues with docker-release #91

Closed simonmau closed 9 months ago

simonmau commented 9 months ago

docker-release of tdlib.native is missing some files? i have created a new asp.net8 app with tdlib.native, and created a container

changes to the default dockerfile: FROM mcr.microsoft.com/dotnet/sdk:8.0 -jammy and the added dotnet build -r linux-x64 my modifications to the dockerfile do not make a difference to the outcome - i just wanted to mention them

when i try to start the container, i get the message:

System.DllNotFoundException: Unable to load shared library 'tdjson' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/app/tdjson.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.1/tdjson.so: cannot open shared object file: No such file or directory
libssl.so.1.1: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.1/libtdjson.so: cannot open shared object file: No such file or directory
/app/tdjson: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.1/tdjson: cannot open shared object file: No such file or directory
/app/libtdjson: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.1/libtdjson: cannot open shared object file: No such file or directory
   at TdLib.Bindings.LinuxBindings.td_json_client_create()
   at TdLib.Bindings.LinuxBindings.ClientCreate()
   at TdLib.TdJsonClient..ctor(ITdLibBindings bindings)
   at TdLib.TdClient..ctor(ITdLibBindings bindings)
   at TdLib.TdClient..ctor()

within the dockerfile, the are all 12 current files from the current release, what am i missing?

the version 1.8.21 is used:

<PackageReference Include="TDLib" Version="1.8.21" />
<PackageReference Include="tdlib.native" Version="1.8.21" />
ForNeVeR commented 9 months ago

Please be more specific and provide the exact steps to reproduce the issue. So far the instructions are unclear.

changes to the default dockerfile: FROM mcr.microsoft.com/dotnet/sdk:8.0 -jammy

I don't understand what is "the default dockerfile" (did not find any default template, dotnet new dockerfile complains that there's no such template), and the syntax you use doesn't seem to be correct (a space before -jammy, like it is an option to the image? never seen anything like this before).

simonmau commented 9 months ago

hi, the space was just so i could mark the changed part as bold, sry the "default template" was generated by visual studio with the new asp.net core webapi project here is my full dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS base

USER app
WORKDIR /app
EXPOSE 8080

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["sample-app/sample-app.csproj", "app/"]
RUN dotnet restore "sample-app/sample-app.csproj"
COPY . .
WORKDIR "/src/app"
RUN dotnet build "sample-app.csproj" -c Release -o /app/build

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

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "sample-app.dll"]
ForNeVeR commented 9 months ago

And the application code?

simonmau commented 9 months ago

here is a sample-application https://github.com/simonmau/tdlib-sample-app

a build of the container can be found here: https://github.com/simonmau/tdlib-sample-app/pkgs/container/tdlib-sample-app/177493629?tag=latest

ForNeVeR commented 9 months ago

Ok, so it looks like "jammy" means Ubuntu 22.04, while we still build against Ubuntu 20.04.

20.04 has libsslv1.1, while 22.04 has libssl.so.3 or something like that (see this answer).

I am not sure how to proceed. 20.04 is still supported (and thus I believe we should support it as well), but I would like to create a version compatible with 22.04 as well. But with the recent changes in the RID graph treatment, I have no idea how to do that.

ForNeVeR commented 9 months ago

This is a duplicate of #66.

eilvelia commented 9 months ago

I am not sure how to proceed. 20.04 is still supported (and thus I believe we should support it as well), but I would like to create a version compatible with 22.04 as well.

Perhaps you can link openssl statically (into a shared library), by using the -DOPENSSL_USE_STATIC_LIBS=TRUE option.

ForNeVeR commented 9 months ago

To be honest, static linking of an SSL library doesn't sound like a good idea. As an option[^1] — maybe, but by default, I'd prefer the artifacts to depend on whatever is installed on the system.

[^1]: And I'm not too interested in adding even more build flavors for now.