惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
MyScale Blog
MyScale Blog
Jina AI
Jina AI
B
Blog
Microsoft Security Blog
Microsoft Security Blog
T
Troy Hunt's Blog
博客园_首页
T
Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
Lohrmann on Cybersecurity
GbyAI
GbyAI
T
Tenable Blog
B
Blog RSS Feed
S
Securelist
T
Threat Research - Cisco Blogs
P
Privacy International News Feed
P
Proofpoint News Feed
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
C
CXSECURITY Database RSS Feed - CXSecurity.com
罗磊的独立博客
AWS News Blog
AWS News Blog
V
V2EX
宝玉的分享
宝玉的分享
J
Java Code Geeks
小众软件
小众软件
Spread Privacy
Spread Privacy
腾讯CDC
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
V
Visual Studio Blog
The Hacker News
The Hacker News
C
CERT Recently Published Vulnerability Notes
Project Zero
Project Zero
Know Your Adversary
Know Your Adversary
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
Apple Machine Learning Research
Apple Machine Learning Research
NISL@THU
NISL@THU
C
Check Point Blog
Webroot Blog
Webroot Blog
D
DataBreaches.Net
Cloudbric
Cloudbric
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家

博客园 - 接云网络

.Net5开发MQTT服务器 使用Docker搭建MQTT服务器 使用Docker搭建MQTT服务器 在Raspberry Pi上安装Docker 阿里云=>RHSA-2019:1884-中危: libssh2 安全更新 MediaAPIController CentOS7 mysql支持中文 设置centos7中的mysql5.7不区分表名大小写有关操作 CentOS7 安装mysql(YUM源方式) centos7下安装nginx CentOS7利用systemctl添加dotnet后台服务 CentOS7利用systemctl添加自定义系统服务 mysql 8.0.13开启远程连接 配置方式 vue 父子组件数据的双向绑定大法 .NET Core 3.0 发布单文件可执行程序 ASP.NET Core 2.1 使用Docker运行 Debian 8 安装Nginx最新版本 postman 发送json请求 Simple ASP.NET CORE 2.2 App +Vue JS
asp.net core In Docker(Image)
接云网络 · 2019-09-20 · via 博客园 - 接云网络

原文地址:https://www.cnblogs.com/stulzq/p/9059108.html

大家应该知道目前.NET Core(2.0)还是没有System.Drawing程序集,如果我们要使用Image等对象来完成生成图片验证码、图片二维码等操作只有通过第三方编写的组件,ZKWeb.System.Drawing便是其中一个,我们使用它以后,我们在windows上运行良好,无需其他额外的操作。但是我们一到Linux运行或者使用Docker(dotnet镜像使用的是ubantu环境)运行时,会发现程序无法正常生成图片,会出现异常,这是因为我们的zk在Linux/Docker下运行需要安装一个名为 libgdiplus 的组件,我们在构建Docker镜像的时候可以通过RUN命令使用apt-get命令进行安装:

RUN apt-get update
RUN apt-get install libgdiplus --assume-yes
RUN cd /usr/lib
RUN ln -s libgdiplus.so gdiplus.dll

apt-get update是非常有必要的

完整的Dockerfile配置提供给大家参考:

FROM microsoft/aspnetcore:2.0 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0 AS build
WORKDIR /src
COPY Alipay.Demo.PCPayment.sln ./
COPY Alipay.Demo.PCPayment/Alipay.Demo.PCPayment.csproj Alipay.Demo.PCPayment/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Alipay.Demo.PCPayment
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
RUN apt-get update
RUN apt-get install libgdiplus --assume-yes
RUN cd /usr/lib
RUN ln -s libgdiplus.so gdiplus.dll
ENTRYPOINT ["dotnet", "Alipay.Demo.PCPayment.dll"]