Build web API project with GroupDocs.Conversion in Docker
To build an web API which is using GroupDocs.Conversion for .NET in docker container use this sample Docker file:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS baseWORKDIR /appEXPOSE 80EXPOSE 443RUN apt-get update && apt-get install -y ffmpeg libgdiplusRUN sed -i'.bak''s/$/ contrib/' /etc/apt/sources.listRUN apt-get update; apt-get install -y ttf-mscorefonts-installer fontconfigRUN fc-cache -f -vFROM mcr.microsoft.com/dotnet/sdk:6.0 AS buildWORKDIR /srcCOPY["YourApi/YourApi.csproj", "TestApi/"]RUN dotnet restore "YourApi/YourApi.csproj"COPY . .WORKDIR "/src/YourApi"RUN dotnet build "YourApi.csproj" -c Release -o /app/buildFROM build AS publishRUN dotnet publish "YourApi.csproj" -c Release -o /app/publishFROM base AS finalWORKDIR /appCOPY --from=publish /app/publish .ENTRYPOINT["dotnet","YourApi.dll"]
As you can see the process is the same as building a regular web API project in docker. The main difference is the installation of needed libraries which allows GroupDocs.Conversion for .NET to work properly in a docker container: