fiso64 / slsk-batchdl

A batch downloader for Soulseek
GNU General Public License v3.0
216 stars 16 forks source link

Add dockerfile and cron setup for sldl with lsio cron #52

Closed FoxxMD closed 1 month ago

FoxxMD commented 1 month ago

Wonderful app you've got here! I'm attempting to get it to run in a docker container so I can have the same functionality as @MCMXD in #41 but with a docker container instead of a VM.

(When this works) A user will be able to exec in to the container and run sldl as normal and/or they can setup a cron file to run sldl on a schedule using a bind-mounted folder from the host.

I'm having some issues with running the app once built that I will detail in the next comment...

FoxxMD commented 1 month ago

The container base uses LSIO's alpine base image which, importantly, does NOT use glibc but rather musl for compiling. This shouldn't be a problem though because microsoft supports developing on alpine with dotnet6 and the container environment is setup to use this and build the solution successfully...

I followed the advice in #41 for replacing the runtime type and am now using this to build the solution:

dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true

The solution builds successfully! For debugging here is the complete log output from running publish:

#12 [8/8] RUN dotnet publish -c Release -r linux-x64 -p:PublishSingleFile=true -p:PublishTrimmed=true --self-contained true
#12 0.300 
#12 0.301 Welcome to .NET 6.0!
#12 0.301 ---------------------
#12 0.301 SDK Version: 6.0.133
#12 0.301 
#12 0.301 ----------------
#12 0.301 Installed an ASP.NET Core HTTPS development certificate.
#12 0.301 To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
#12 0.301 Learn about HTTPS: https://aka.ms/dotnet-https
#12 0.301 ----------------
#12 0.301 Write your first app: https://aka.ms/dotnet-hello-world
#12 0.301 Find out what's new: https://aka.ms/dotnet-whats-new
#12 0.301 Explore documentation: https://aka.ms/dotnet-docs
#12 0.301 Report issues and find source on GitHub: https://github.com/dotnet/core
#12 0.301 Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
#12 0.301 --------------------------------------------------------------------------------------
#12 0.501 Microsoft (R) Build Engine version 17.0.3+d679d2092 for .NET
#12 0.501 Copyright (C) Microsoft Corporation. All rights reserved.
#12 0.501 
#12 0.853   Determining projects to restore...
#12 3.355   Restored /app/slsk-batchdl/slsk-batchdl.csproj (in 2.31 sec).
#12 5.277 /app/slsk-batchdl/Utils.cs(219,36): warning CS8714: The type 'K' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'K' doesn't match 'notnull' constraint. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(18,12): warning CS8618: Non-nullable field '_server' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(51,38): warning CS8622: Nullability of reference types in type of parameter 'state' of 'Task Spotify.OnErrorReceived(object sender, string error, string state)' doesn't match the target delegate 'Func<object, string, string?, Task>' (possibly because of nullability attributes). [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(23,31): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4894,47): warning CS8604: Possible null reference argument for parameter 'path' in 'DirectoryInfo Directory.CreateDirectory(string path)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4905,41): warning CS8604: Possible null reference argument for parameter 'relativeTo' in 'string Path.GetRelativePath(string relativeTo, string path)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(109,32): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(111,35): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(113,37): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(113,37): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<string?> Enumerable.Select<object, string?>(IEnumerable<object> source, Func<object, string?> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(113,107): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(113,36): warning CS8619: Nullability of reference types in value of type 'string?[]' doesn't match target type 'string[]'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(115,31): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(116,32): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(117,32): warning CS8605: Unboxing a possibly null value. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(118,45): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(118,77): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Utils.cs(221,32): warning CS8714: The type 'K' cannot be used as type parameter 'TKey' in the generic type or method 'Dictionary<TKey, TValue>'. Nullability of type argument 'K' doesn't match 'notnull' constraint. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(136,21): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(143,23): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(152,35): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(156,41): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(156,41): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<string?> Enumerable.Select<object, string?>(IEnumerable<object> source, Func<object, string?> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(156,111): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(156,40): warning CS8619: Nullability of reference types in value of type 'string?[]' doesn't match target type 'string[]'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(160,33): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(160,33): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(161,33): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(161,33): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(162,34): warning CS8605: Unboxing a possibly null value. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(163,31): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(163,31): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(180,29): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(184,29): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(193,40): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(193,27): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Spotify.cs(197,31): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(242,32): warning CS0618: 'Author.Title' is obsolete: 'Use ChannelTitle instead.' [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(244,35): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(279,32): warning CS0618: 'Author.Title' is obsolete: 'Use ChannelTitle instead.' [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(281,35): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(298,30): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(557,26): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(536,75): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(601,34): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(602,50): warning CS8604: Possible null reference argument for parameter 'path' in 'string[] Directory.GetFiles(string path, string searchPattern, SearchOption searchOption)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(573,38): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(438,44): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(447,42): warning CS8603: Possible null reference return. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(465,20): warning CS8603: Possible null reference return. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/YouTube.cs(445,34): warning CS0168: The variable 'e' is declared but never used [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1174,55): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1181,59): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1192,63): warning CS8600: Converting null literal or possible null value to non-nullable type. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1209,29): warning CS8604: Possible null reference argument for parameter 'str' in 'string Utils.ReplaceInvalidChars(string str, string replaceStr, bool windows = false, bool removeSlash = true, bool alwaysRemoveSlash = false)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1130,25): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1132,29): warning CS8601: Possible null reference assignment. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1277,23): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1371,13): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1386,44): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1394,44): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1495,59): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1497,28): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1499,70): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<File> Enumerable.Select<KeyValuePair<string, (SearchResponse, File)>, File>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source, Func<KeyValuePair<string, (SearchResponse, File)>, File> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1555,13): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1599,26): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1635,13): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1698,79): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<string> Enumerable.Select<KeyValuePair<string, (SearchResponse, File)>, string>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source, Func<KeyValuePair<string, (SearchResponse, File)>, string> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1702,69): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1704,32): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1706,74): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<File> Enumerable.Select<KeyValuePair<string, (SearchResponse, File)>, File>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source, Func<KeyValuePair<string, (SearchResponse, File)>, File> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1737,34): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1831,65): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1845,9): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1660,90): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1664,69): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1665,49): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1666,68): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1673,49): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1674,68): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1892,28): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1895,70): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<File> Enumerable.Select<KeyValuePair<string, (SearchResponse, File)>, File>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source, Func<KeyValuePair<string, (SearchResponse, File)>, File> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1927,79): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1931,73): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(1979,19): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2014,23): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2062,56): warning CS8604: Possible null reference argument for parameter 'progress' in 'SearchInfo.SearchInfo(ConcurrentDictionary<string, (SearchResponse, File)> results, ProgressBar progress)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2184,77): warning CS8604: Possible null reference argument for parameter 'progress' in 'Task Program.DownloadFile(SearchResponse response, File file, string filePath, Track track, ProgressBar progress, CancellationTokenSource? searchCts = null)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2191,26): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2333,20): warning CS8603: Possible null reference return. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2420,26): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2518,34): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2519,34): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2528,32): warning CS8629: Nullable value type may be null. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2735,15): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2742,19): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2953,35): warning CS8604: Possible null reference argument for parameter 'path' in 'DirectoryInfo Directory.CreateDirectory(string path)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(2975,19): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(3013,25): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(3681,16): warning CS8603: Possible null reference return. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(3704,65): warning CS8604: Possible null reference argument for parameter 'path' in 'string Path.GetRelativePath(string relativeTo, string path)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(3708,47): warning CS8604: Possible null reference argument for parameter 'path' in 'DirectoryInfo Directory.CreateDirectory(string path)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4016,44): warning CS8604: Possible null reference argument for parameter 'value' in 'bool Dictionary<Track, string>.TryAdd(Track key, string value)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4030,18): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4352,72): warning CS8604: Possible null reference argument for parameter 'source' in 'IEnumerable<string> Enumerable.Select<KeyValuePair<string, (SearchResponse, File)>, string>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source, Func<KeyValuePair<string, (SearchResponse, File)>, string> selector)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4358,35): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4393,68): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4394,43): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4405,80): warning CS8604: Possible null reference argument for parameter 'source' in 'KeyValuePair<string, (SearchResponse, File)> Enumerable.First<KeyValuePair<string, (SearchResponse, File)>>(IEnumerable<KeyValuePair<string, (SearchResponse, File)>> source)'. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4406,64): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4407,39): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.277 /app/slsk-batchdl/Program.cs(4481,49): warning CS8602: Dereference of a possibly null reference. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 5.562   slsk-batchdl -> /app/slsk-batchdl/bin/Release/net6.0/linux-x64/sldl.dll
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataSet.WriteXmlSchema(DataSet,XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.GetSchema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataSet.ReadXmlSerializableInternal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataSet.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataSet.WriteXmlInternal(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataSet.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.GetSchema(): Using member 'System.Data.DataTable.GetXmlSchema()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.GetSchema uses TypeDescriptor and XmlSerialization underneath which are not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.ReadXml(XmlReader): Using member 'System.Data.DataTable.ReadXmlSerializableInternal(XmlReader)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.ReadXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 ILLink : Trim analysis warning IL2026: System.Data.DataTable.System.Xml.Serialization.IXmlSerializable.WriteXml(XmlWriter): Using member 'System.Data.DataTable.WriteXmlInternal(XmlWriter)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. DataTable.WriteXml uses XmlSerialization underneath which is not trimming safe. Members from serialized types may be trimmed if not referenced directly. [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/anglesharp/1.1.2/lib/net6.0/AngleSharp.dll : warning IL2104: Assembly 'AngleSharp' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/embedio/3.5.2/lib/netstandard2.0/EmbedIO.dll : warning IL2104: Assembly 'EmbedIO' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/google.apis.core/1.63.0/lib/netstandard2.0/Google.Apis.Core.dll : warning IL2104: Assembly 'Google.Apis.Core' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/google.apis/1.63.0/lib/netstandard2.0/Google.Apis.dll : warning IL2104: Assembly 'Google.Apis' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/htmlagilitypack/1.11.54/lib/netstandard2.0/HtmlAgilityPack.dll : warning IL2104: Assembly 'HtmlAgilityPack' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/newtonsoft.json/13.0.3/lib/net6.0/Newtonsoft.Json.dll : warning IL2104: Assembly 'Newtonsoft.Json' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/soulseek/6.5.0/lib/netstandard2.1/Soulseek.dll : warning IL2104: Assembly 'Soulseek' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/spotifyapi.web/7.1.1/lib/net6.0/SpotifyAPI.Web.dll : warning IL2104: Assembly 'SpotifyAPI.Web' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/system.codedom/7.0.0/lib/net6.0/System.CodeDom.dll : warning IL2104: Assembly 'System.CodeDom' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/taglibsharp/2.3.0/lib/netstandard2.0/TagLibSharp.dll : warning IL2104: Assembly 'TagLibSharp' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 11.60 /root/.nuget/packages/unosquare.swan.lite/3.1.0/lib/netstandard2.0/Swan.Lite.dll : warning IL2104: Assembly 'Swan.Lite' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/app/slsk-batchdl/slsk-batchdl.csproj]
#12 12.60   Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
#12 12.67   slsk-batchdl -> /app/slsk-batchdl/bin/Release/net6.0/linux-x64/publish/
#12 DONE 12.7s

The release directory looks correct AFAIK. Checking the publish folder showing a binary blob that is executable:

root@7c7ff067929e:/app#ls -la slsk-batchdl/bin/Release/net6.0/linux-x64/publish/sldl
-rwxr-xr-x 1 root root 26575454 Aug 23 16:53 slsk-batchdl/bin/Release/net6.0/linux-x64/publish/sldl

However trying to run the binary return cannot execute: required file not found

root@7c7ff067929e:/app#slsk-batchdl/bin/Release/net6.0/linux-x64/publish/sldl
bash: slsk-batchdl/bin/Release/net6.0/linux-x64/publish/sldl: cannot execute: required file not found

I have made sure all required dependencies are installed for a self-contained app, AFAIK. Even installed the runtime though it should not be needed since the SDK is installed.

I'm not sure how else to determine what the issue is with the binary at this point. I'm also not familiar with developing for dotnet core. Are there any commands or debugging processes you can point me to to further diagnose what is missing to make the binary run?


To reproduce, clone my branch and then from the project directory:

docker build -t sldl .
docker container exec -it sldl /bin/bash
cd slsk-batchdl/bin/Release/net6.0/linux-x64/publish
./sldl
FoxxMD commented 1 month ago

Of course I figured it out immediately after posting... :smiling_face_with_tear:

Since it's musl the runtime type (-r) needs to be linux-musl-x64 instead of linux-x64

FoxxMD commented 1 month ago

Ok docker is working well now and can build to both x86 and ARM. Added docs and cron usage.

Additionally, I included a github workflow if you would like to enable automated image publishing for the repository and optionally publishing to dockerhub.

If you don't want to use this workflow you don't need to do anything, it will not run unless the settings below are enabled by you.

On Push

Triggers on these actions and publishes accordingly:

To enable

FoxxMD commented 1 month ago

And if anyone wants to try out the image its available at docker.io/foxxmd/slsk-batch:latest See updated docs for docker usage.

fiso64 commented 1 month ago

I'll merge this (thanks!), but I'm not sure if the automatic publishing is a good idea. I don't use docker myself, so I wouldn't be able to verify that the image works after an update..

FoxxMD commented 1 month ago

Not a problem. I'm watching the repo and will build to my own docker.io/foxxmd/slsk-batch:latest image when releases are made (when I get around to it!)