Aspose.Words Run in Docker

Hello,

I need help in setting up my aspose.words project in Docker, could you please share how can I do that?

Thanks in advance.

@mstc Please see our documentation to learn how to run Aspose.Words for .NET in Docker:
https://docs.aspose.com/words/net/how-to-run-aspose-words-in-docker/

Here is a simple example with Amazon 2 Linux docker image:

FROM amazonlinux:2 AS base

# Install .NET6 SDK
RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
RUN yum install dotnet-sdk-6.0 -y

WORKDIR /src
COPY ["TestNet6.csproj", "."]
RUN dotnet restore "./TestNet6.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "TestNet6.csproj" -c Release -o /app/build
RUN dotnet publish "TestNet6.csproj" -c Release -r linux-x64 --no-self-contained -o /app/publish

ENTRYPOINT ["dotnet", "/app/publish/TestNet6.dll"]

Here is .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  
   <PropertyGroup>
     <InvariantGlobalization>false</InvariantGlobalization>
   </PropertyGroup>

  <ItemGroup>
	  <PackageReference Include="Aspose.Words" Version="23.7.0" />
	  <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.80.3" />
  </ItemGroup>

</Project>

Here is the test code:

using Aspose.Words;
using System;
using System.Diagnostics;

namespace Aspose.NetCore.TestRunner
{
    class Program
    {
        static void Main(string[] args)
        {
            License lic = new License();
            lic.SetLicense("/temp/Aspose.Words.NET.lic");

            Console.WriteLine("Test started.");

            Document doc = new Document("/temp/in.docx");
            doc.Save(@"/temp/out.pdf");

            sw.Stop();
            Console.WriteLine(sw.ElapsedMilliseconds / 1000d);

            Console.WriteLine("Done");
        }
    }
}

I run the test using the following commands:

docker build -f Dockerfile_amazon -t awtest .
docker run --mount type=bind,source=C:\Temp,target=/temp --rm awtest from Docker