You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rendering in Linux is different than Windows when it comes to pixel alignment (#340) and fonts (#1649, #1310, #1079) and it is helpful to have an easy way to inspect images rendered using Linux.
ScottPlot tests work on my machine in Linux using WSL, but it seems more useful to run these tests in a Docker container
I am able to build the project in docker, but the NUnit3 tests fail to run:
System.IO.FileNotFoundException:
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Culture=neutral, PublicKeyToken=null'.
The system cannot find the file specified.
Hi,
since I'm a 'docker beginner' tried to make the same approach described here
copied the following Dockerfile into folder dev/ScottPlot5
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /source
# copy csproj and restore as distinct layers
COPY ScottPlot/*.csproj ScottPlot/
RUN dotnet restore ScottPlot/ScottPlot.csproj
# copy and build lib
COPY ScottPlot/* ScottPlot/
WORKDIR /source/ScottPlot
RUN dotnet build -c release --no-restore
RUN apt-get update
RUN apt-get install -y fontconfig
# test stage -- exposes optional entrypoint
# target entrypoint with: docker build --target test
FROM build AS test
WORKDIR /source/ScottPlotTests
COPY ScottPlotTests/* .
ENTRYPOINT ["dotnet", "test", "--logger:trx"]
FROM build AS publish
RUN dotnet publish -c release --no-build -o /app
# final stage/image
FROM mcr.microsoft.com/dotnet/runtime:6.0
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ScottPlot.dll"]
create a TestResult folder under ScottPlot5/
calling from powershell
docker build --pull --target test -t scottplot-test .
and run container with
docker run --rm -v $pwd\ScottPlot5\TestResults:/source/ScottPlotTests/TestResults scottplot-test
after that in the TestResult folder I got the test results.
Had two issues:
Before installing the fontconfig library I got an error that the libSkiaSharp could not be loaded.
(SkiaSharp has a dependency of the fontconfig lib)
The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
at SkiaSharp.SkiaApi.sk_version_get_milestone()
at SkiaSharp.SkiaSharpVersion.get_Native()
at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
at SkiaSharp.SKObject..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
at SkiaSharp.SKObject.set_Handle(IntPtr value)
at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
at SkiaSharp.SKObject.Dispose(Boolean disposing)
at SkiaSharp.SKPaint.Dispose(Boolean disposing)
at SkiaSharp.SKNativeObject.Finalize()
had to add the following lines into the project file of ScottPlot assembly
This will help a lot when I pick-up work on ScottPlot 5 again! You said you're a Docker beginner, but I'm far more of a beginner, and I really appreciate you looking into this and sharing your findings. 🚀✨
Activity
grabul commentedon Mar 12, 2022
Hi,
since I'm a 'docker beginner' tried to make the same approach described here
copied the following Dockerfile into folder dev/ScottPlot5
create a TestResult folder under ScottPlot5/
calling from powershell
docker build --pull --target test -t scottplot-test .and run container with
docker run --rm -v $pwd\ScottPlot5\TestResults:/source/ScottPlotTests/TestResults scottplot-testafter that in the TestResult folder I got the test results.
Had two issues:
(SkiaSharp has a dependency of the fontconfig lib)
because of error
error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [/source/ScottPlot/ScottPlot.csproj]hope that helps ...
swharden commentedon May 6, 2022
Thank you so much @grabul!
This will help a lot when I pick-up work on ScottPlot 5 again! You said you're a Docker beginner, but I'm far more of a beginner, and I really appreciate you looking into this and sharing your findings. 🚀✨