System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies .NET Core 图片操作在 Linux/Docker 下的坑

复制代码
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

RUN echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib \
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib \
deb http://mirrors.aliyun.com/debian-security stretch/updates main \
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main \
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" > /etc/apt/sources.list
 
RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["xxx/xxx.csproj", "xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx/xxx.xxx.csproj", "xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
COPY ["xxx.xxx/xxx.xxx.csproj", "xxx.xxx/"]
RUN dotnet restore "xxx/xxx.csproj"
COPY . .
WORKDIR "/src/xxx"
RUN dotnet build "xxx.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "xxx.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "xxx.dll"]
复制代码

参考文章:https://www.cnblogs.com/stulzq/p/10172550.html

                  https://www.cnblogs.com/stulzq/p/9339250.html

posted on   落叶子  阅读(1590)  评论(0编辑  收藏  举报

编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2019-04-10 abp 关闭审计日志
2019-04-10 abp core版本添加额外应用层

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示