.NET Core + Docker Alpine + JsReport Local: No such file or directory



  • Hello,

    I'm trying to run JsReport with .NET Core on a Docker Alpine image.

    I think that the problem is related to that "hack"

    https://jsreport.net/learn/dotnet-local#docker

    Can someone help me translate that to Alpine commands ?

    Follow my current configuration and stacktrace.

    Startup.cs

    services.AddJsReport(new LocalReporting()
                        .UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
                                            jsreport.Binary.JsReportBinary.GetBinary() :
                                            jsreport.Binary.Linux.JsReportBinary.GetBinary())
                        .KillRunningJsReportProcesses()
                        .AsUtility()
                        .Create());
    

    Controller

    [HttpGet("generate/{uid}"), Route("generate")]
    [MiddlewareFilter(typeof(JsReportPipeline))]
    public IActionResult GenerateReport([FromQuery] Guid uid)
    {
       ReportResponseModel model = _reportHelper.Get(uid);
    
       HttpContext.JsReportFeature().Recipe(Recipe.ChromePdf)
       .Configure(c => c.Template.Chrome = new Chrome
       {
          Landscape = model.Landscape
       });
    
       return View(model.ViewName, model.ViewModel);
    }
    

    Dockerfile

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS base
    RUN apk add --no-cache icu-libs
    ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
    RUN apk add --update tzdata
    ENV TZ=America/Sao_Paulo
    WORKDIR /app
    EXPOSE 80
    EXPOSE 443
    
    

    Stacktrace

    System.ComponentModel.Win32Exception (2): No such file or directory
    at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
    at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
    at System.Diagnostics.Process.Start()
    at jsreport.Local.Internal.BinaryProcess.InnerExecute(String cmd, Boolean waitForExit)
    at jsreport.Local.Internal.BinaryProcess.ExecuteExe(String cmd, Boolean waitForExit)
    at jsreport.Local.Internal.LocalUtilityReportingService.RenderAsync(String requestString, CancellationToken ct)
    at jsreport.AspNetCore.JsReportMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
     End of stack trace from previous location where exception was thrown ---
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
    at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
    at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
    



Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.