Dockerfile Licensing

Posted by: dave.willis on 26 October 2023, 1:35 am EST

    • Post Options:
    • Link

    Posted 26 October 2023, 1:35 am EST - Updated 26 October 2023, 3:38 am EST

    I am trying to get a dotnet 6.0 Dockerfile based build working while licensing Active Reports 16, and I’ve yet to have any success. I believe have followed the recommended way of doing this via the gclm tool. My Dockerfile contains the following snippet centred around licensing the application:

    # Run restore as a distinct layer.
    RUN dotnet restore "src/Reports.API/Reports.API.csproj"
    
    COPY . .
    
    WORKDIR "/App/src/Reports.API"
    
    FROM build-env AS publish
    ENV PATH="${PATH}:/root/.dotnet/tools"
    RUN dotnet tool install -g GrapeCity.LicenseManagerTool
    RUN gclm "5e0b5f44-1a6b-4aff-a007-17b9224bca83" -lc ./.gclicx "Reports.API.dll"
    # Build and publish a release
    RUN dotnet publish "Reports.API.csproj" --no-restore -c Release -o /App/out /p:UseAppHost=false
    
    FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime-env
    EXPOSE 80
    WORKDIR /App
    COPY --from=publish /App/out .
    ENTRYPOINT ["dotnet", "Reports.API.dll"]

    When performing a Docker build I’m receving the following error from the gclm tool: error: Failed to generate license for 5e0b5f44-1a6b-4aff-a007-17b9224bca83. Details: No License.

    The .gclicx was generated on a licensed Windows machine using both VS2022, and when that file failed in the Docker build, I used the tool installed in C:\ProgramData\GrapeCity\gclm which produced a file with the same contents that also failed.

    I am ultimately using the above method because we wish to perform builds via a devops pipeline for releases (as well as local builds), and we do not want to purchase another license just to license the pipeline.

  • Posted 26 October 2023, 5:37 pm EST - Updated 26 October 2023, 8:37 pm EST

    Hi Dave,

    Could you please make sure if the Docker Image is licensed correctly? You can check the License status by referring to the following pages of our documentation: Check the License Status

    Make sure to replace the GUID from “742a5cf8-2204-4873-9dc9-ff56d67411bd” to “5e0b5f44-1a6b-4aff-a007-17b9224bca83”.

    I followed the following steps to test this out at my end and I wasn’t able to reproduce the issue at my end:

    1. Create .Net Core Application using ActiveReports. I am using the attached application. DockerJSViewerCore - Developer License

    2. Create a docker file and save it in your application I have used the following code to create the Dockerfile:

    # Use the official ASP.NET 6 runtime image
    FROM mcr.microsoft.com/dotnet/sdk:6.0
    ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
    ENV ASPNETCORE_URLS http://*:5000
    # Set the working directory to /app
    WORKDIR /app
    # Copy the published output of your .NET 6 MVC app to the container
    COPY . .
    #Install GrapeCity.LicenseManagerTool
    Run dotnet tool install -g GrapeCity.LicenseManagerTool
    Run export PATH="$PATH:/root/.dotnet/tools"
    Run echo $PATH
    #License the image.
    Run gclm "5e0b5f44-1a6b-4aff-a007-17b9224bca83" -a "LICENSE KEY" 
    #Publish the application
    Run dotnet publish -c Release
    # Deactivate License
    Run gclm "5e0b5f44-1a6b-4aff-a007-17b9224bca83" -d
    # Expose the port your app will listen on
    EXPOSE 5000
    ENTRYPOINT ["dotnet", "./bin/Release/net6.0/publish/DockerJSViewerCore.dll"]
    

    Note: Make sure to deactivate the license after every build as with each developer license you can license up to 3 machines at a time and if a machine is destroyed or fails without deactivating the license you will loose one activation.

    Note: Each developer license key can be activated/deactivated up to 9 times in a day.

    1. Now open Powershell in the Project Location and run the following commands:
    docker build -t jsviewer-docker-app . --progress=plain
    docker run -d -p 5000:5000 jsviewer-docker-app 
    
    1. In your machine open Browser and go to URL: http://localhost:5000

    I hope this will help you set up the docker image for your application.

    DockerJSViewerCore Developer License.zip

  • Posted 26 October 2023, 7:07 pm EST

    Thanks for your prompt response Akshay.

    I did attempt this method yesterday, and I hit the dreaded ‘you’ve run out of available uses of this serial key’, I have since requested a reactivation and now the pipeline is working. Thank you for your assistance.

  • Posted 29 October 2023, 2:41 pm EST

    Hi Dave,

    I am glad to know the issue is resolved!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels