wkhtmltopdf not working with .net 8 and docker file

293 views Asked by At

I am using wkhtmltopdf for html to pdf conversions in one of my web applications. Currently I am upgrading my project from .net 6 to .net 8.

Problem is , when i build and try to run the application after upgrade i am getting below error in my application

Severity Code Description Project File Line Suppression State Error DT1001 failed to solve: process "/bin/sh -c apt-get install -y --no-install-recommends zlib1g fontconfig libfreetype6 libx11-6 libxext6 libxrender1 wget gdebi" did not complete successfully: exit code: 100 If the error persists, try restarting Docker Desktop. docker-compose C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 425

Below is my Docker file.

FROM mcr.microsoft.com/dotnet/sdk:8.0 as base
WORKDIR /app
# RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y --no-install-recommends libgdiplus \
    && rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/lib/libgdiplus.so /lib/x86_64-linux-gnu/libgdiplus.so
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        zlib1g \
        fontconfig \
        libfreetype6 \
        libx11-6 \
        libxext6 \
        libxrender1 \
        xfonts-75dpi \
        xfonts-base \
        wget \
        gdebi \
    && rm -rf /var/lib/apt/lists/*
RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb
RUN gdebi --n wkhtmltox_0.12.5-1.stretch_amd64.deb
# mlm - I question the validity of using the libssl1.0-dev
# package below. The docs say this: "This is a transition package that will go away after the stretch release to provide the 1.0.X APIs for those packages that are not ready for the 1.1 version yet."
# https://packages.debian.org/stretch/libssl1.0-dev
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
    libssl1.1 \
    && rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/local/lib/libwkhtmltox.so /usr/lib/libwkhtmltox.so

Please suggest any changes required for wkhtmltopdf docker image changes.

0

There are 0 answers