diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..3729ff0cd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs index 587a43e71..9da53fd03 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs +++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/binding.cs @@ -83,8 +83,24 @@ namespace Unix.Terminal { static void LoadMethods () { var libs = UnmanagedLibrary.IsMacOSPlatform ? new string [] { "libncurses.dylib" } : new string [] { "libncursesw.so.6", "libncursesw.so.5" }; - curses_library = new UnmanagedLibrary (libs, false); - methods = new NativeMethods (curses_library); + var attempts = 1; + while (true) { + try { + curses_library = new UnmanagedLibrary (libs, false); + methods = new NativeMethods (curses_library); + break; + } catch (Exception ex) { + + if (attempts == 1) { + attempts++; + if (Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystem.Contains ("opensuse")) { + libs [0] = "libncursesw.so.5"; + } + } else { + throw ex.GetBaseException (); + } + } + } } static void FindNCurses () diff --git a/UICatalog/Dockerfile b/UICatalog/Dockerfile new file mode 100644 index 000000000..7d3552bb9 --- /dev/null +++ b/UICatalog/Dockerfile @@ -0,0 +1,35 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM opensuse/tumbleweed AS base +RUN zypper -n update +RUN zypper --non-interactive install libicu +RUN zypper --non-interactive install libncurses5 +RUN zypper --non-interactive install wget +RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc +RUN wget https://packages.microsoft.com/config/opensuse/15/prod.repo +RUN mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo +RUN chown root:root /etc/zypp/repos.d/microsoft-prod.repo +RUN zypper --non-interactive install dotnet-sdk-7.0 + +ENV LANG=en_US.UTF-8 \ + TERM=xterm-256color \ + DISPLAY=:0 +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +WORKDIR /src +COPY ["Terminal.Gui/Directory.Build.props", "Terminal.Gui/"] +COPY ["UICatalog/UICatalog.csproj", "UICatalog/"] +COPY ["Terminal.Gui/Terminal.Gui.csproj", "Terminal.Gui/"] +RUN dotnet restore "UICatalog/UICatalog.csproj" +COPY . . +WORKDIR "/src/UICatalog" +RUN dotnet build "UICatalog.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "UICatalog.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "UICatalog.dll"] \ No newline at end of file diff --git a/UICatalog/Properties/launchSettings.json b/UICatalog/Properties/launchSettings.json index 4fe02b923..9a4d02e14 100644 --- a/UICatalog/Properties/launchSettings.json +++ b/UICatalog/Properties/launchSettings.json @@ -50,6 +50,9 @@ "Windows & FrameViews": { "commandName": "Project", "commandLineArgs": "\"Windows & FrameViews\"" + }, + "Docker": { + "commandName": "Docker" } } } \ No newline at end of file diff --git a/UICatalog/UICatalog.csproj b/UICatalog/UICatalog.csproj index 7dac6ac09..439b64a3e 100644 --- a/UICatalog/UICatalog.csproj +++ b/UICatalog/UICatalog.csproj @@ -11,6 +11,7 @@ 1.10.1.0 1.10.1 1.10.1+6.Branch.main.Sha.f7ee66ddbf8dbcfb0d96af7d63789879091670ec + Linux TRACE @@ -22,6 +23,7 @@ +