.netcore基础镜像缺少libgdiplus包导致构建缓慢的问题

每次构建下载安装libgdiplus,导致构建非常慢。

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

COPY  bin/Release/netcoreapp3.1 .

#System.Drawing.Common
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list 
RUN apt-get update -y && apt-get install -y libgdiplus locales fontconfig && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

ENTRYPOINT ["dotnet", "xxx.dll"]

 

制作一个带libgdiplus的基础镜像,Dockerfile ↓

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim

RUN echo "deb http://mirrors.aliyun.com/debian/ buster main contrib non-free \
          deb http://mirrors.aliyun.com/debian/ buster-updates main contrib non-free \
          deb http://mirrors.aliyun.com/debian/ buster-backports main contrib non-free \
          deb http://mirrors.aliyun.com/debian-security buster/updates main contrib non-free \
          " > /etc/apt/sources.list

RUN apt-get update -y && apt-get install -y libgdiplus locales fontconfig && apt-get clean && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll

 

构建镜像aspnet:3.1-buster-slim-gdi

docker build -f Dockerfile路径 -t mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim-gdi .

 

参考 https://www.cnblogs.com/wh-blog/p/11797530.html

posted @ 2020-11-03 18:36  找不到一个满意的昵称  阅读(823)  评论(0编辑  收藏  举报