Coder Social home page Coder Social logo

Comments (6)

HakanL avatar HakanL commented on July 19, 2024 1

Most likely you need to install some additional dependencies. Try to terminal into the container and temporarily install the libwkhtmltox library and see what it needs.

Here's the dockerfile I'm using for reference:

# App image (use the Debian-based based since wkhtmltopdf has dependencies that aren't readily available in Alpine)
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS final

# Install dependencies
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        zlib1g \
		libgdiplus \
        libc6-dev \
		ca-certificates \
		fontconfig \
		fontconfig-config \
		fonts-dejavu-core \
		libbsd0 \
		libexpat1 \
		libfontconfig1 \
		libfontenc1 \
		libfreetype6 \
		libjpeg62-turbo \
		libpng16-16 \
		libssl1.1 \
		libx11-6 \
		libx11-data \
		libxau6 \
		libxcb1 \
		libxdmcp6 \
		libxext6 \
		libxrender1 \
		ucf \
		x11-common \
		xfonts-75dpi \
		xfonts-base \
		xfonts-encodings \
		xfonts-utils \
     && rm -rf /var/lib/apt/lists/*

# Builder image to run the clean up in and use as a copy base
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder1
WORKDIR /sln

# Copy across all source files
COPY . .

# Delete files we don't need so Docker can capture this and we can use it as a copy source later
RUN find . -type f ! \( -name "*.*proj" -o -name "*.sln" -o -name "NuGet.config" \) -delete && \
	find . -depth -type d -exec rmdir {} \; 2>/dev/null

# Create a new stage based on the cleaned-up source
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder
WORKDIR /sln

# Install dependencies
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
	&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
	&& wget -q https://packages.microsoft.com/config/debian/10/prod.list \
	&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
	&& chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
	&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
		apt-transport-https \
	&& apt-get update \
	&& apt-get install -y --no-install-recommends \
		dotnet-sdk-3.1 \
     && rm -rf /var/lib/apt/lists/*

# Copy out all the project files necessary for dotnet restore from builder1
COPY --from=builder1 /sln .

RUN dotnet restore

# Copy across the files again for the full build
COPY ./test ./test
COPY ./src ./src

RUN dotnet build -c Release "./src/ServiceHostDocumentGenerator/ServiceHostDocumentGenerator.csproj"

RUN dotnet publish "./src/ServiceHostDocumentGenerator/ServiceHostDocumentGenerator.csproj" \
    -c Release -o "dist" --no-restore


# App image
FROM final
WORKDIR /app
EXPOSE 80
COPY --from=builder /sln/dist .
ENTRYPOINT ["dotnet", "ServiceHostDocumentGenerator.dll"]

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024

It could be a dependency for libwkhtmltox. Try to install that library directly (outside .NET) and see if ti works.

from wkhtmltopdf-dotnet.

ClementeGao avatar ClementeGao commented on July 19, 2024

the project run in the docker how install the library

from wkhtmltopdf-dotnet.

ClementeGao avatar ClementeGao commented on July 19, 2024

ok thank you very much l will try it

from wkhtmltopdf-dotnet.

ClementeGao avatar ClementeGao commented on July 19, 2024

do you have easy way to solve it ?

from wkhtmltopdf-dotnet.

HakanL avatar HakanL commented on July 19, 2024

Not sure what you mean, this is common when you work with dockers, the base image may not have all the dependencies installed, so you have to add those to your Dockerfile. But I provided an example above that includes everything you need.

from wkhtmltopdf-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.