Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux Dcoker构建 .NET8 按HTML模版导出PDF 报错找不到libjpeg62,同样的环境.NET7打包运行后导出PDF就正常 #553

Open
zhuoyue03007 opened this issue Mar 20, 2024 · 6 comments

Comments

@zhuoyue03007
Copy link

Expected behaviour

Tell us what should happen.

One or more errors occurred. (Unable to load native library. The platform may be missing native dependencies (libjpeg62, etc). Or the current platform is not supported.)
换回.NET7 构建的就没有这个问题,正常导出PDF
尝试Dcoerfile构建时 安装 libjpeg62这些 问题依然没有解决,哪位大哥有解决方案说下 Magicodes.IE.Pdf 是2.7.5.1版本

@youpangle
Copy link

youpangle commented Mar 21, 2024

请问这个问题解决了吗?我在.NET7中也报了同样的问题 Magicodes.IE.Pdf 也是2.7.5.1版本 你的DockerFile文件中.net 7是用的什么版本

@zhuoyue03007
Copy link
Author

请问这个问题解决了吗?我在.NET7中也报了同样的问题 Magicodes.IE.Pdf 也是2.7.5.1版本 你的DockerFile文件中.net 7是用的什么版本

还是这个版本2.7.5.1 Docker 后是正常的

@lamposu
Copy link

lamposu commented Oct 8, 2024

.net8 下遇到同样的问题。。

@lamposu
Copy link

lamposu commented Oct 8, 2024

已解决,应该是缺少了一些本地文件,懒得去找了,重新安装wkhtmltopdf就好了:

RUN apt-get update
&& apt-get install -y --no-install-recommends
ca-certificates

# .NET dependencies
libc6
libgcc-s1
libicu72
libssl3
libstdc++6
tzdata
zlib1g
# Chinese font-family
fonts-noto-cjk
fonts-wqy-microhei
fontconfig
curl
&& curl -fSL --output wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
&& apt-get --fix-broken install -y --no-install-recommends ./wkhtmltopdf.deb
&& rm -rf /var/lib/apt/lists/*

@zhuoyue03007
Copy link
Author

已解决,应该是缺少了一些本地文件,懒得去找了,重新安装wkhtmltopdf就好了:

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates # .NET dependencies libc6 libgcc-s1 libicu72 libssl3 libstdc++6 tzdata zlib1g # Chinese font-family fonts-noto-cjk fonts-wqy-microhei fontconfig curl && curl -fSL --output wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && apt-get --fix-broken install -y --no-install-recommends ./wkhtmltopdf.deb && rm -rf /var/lib/apt/lists/*

能看下你Dcoerfile文件里怎么写的吗?我这构建还是有问题

@lamposu
Copy link

lamposu commented Oct 19, 2024

就是net的dockerfile官方模版在开头加上就行啦,网络下载很慢,所以我开启了build cache,第二次就飞快了。

# syntax = docker/dockerfile:1.2
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
# Install libgdiplus
RUN apt-get update && apt-get install -y libgdiplus libc6-dev && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libc6 libgcc-s1 libicu72 libssl3 libstdc++6 tzdata zlib1g curl && curl -fSL --output wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb --http1.1 && apt-get --fix-broken install -y --no-install-recommends ./wkhtmltopdf.deb && rm -rf /var/lib/apt/lists/*
# Install fontconfig library for Pdf export
RUN apt-get update && apt-get install -y fontconfig

WORKDIR /app
EXPOSE 80 443

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY *.sln ./
COPY ["proj/test.csproj", "proj/"]
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages dotnet restore

# copy and build app and libraries
COPY . .
WORKDIR "/src/proj"
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages dotnet build "test.csproj" -c Release -o /app --no-restore

FROM build AS publish
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages dotnet publish "test.csproj" -c Release -o /app --no-restore

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "test.dll"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants