基于Debian Docker镜像添加中文字体

发布时间 2023-08-29 13:50:23作者: SpringCore

1.选择需要添加的中文字体到一个目录中。

从Windows中拷贝出需要的字体即可,目录地址:C:\Windows\Fonts

2.编辑Dockerfile,添加中文字体【以dotnet镜像为例,其基于Debian】

FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
EXPOSE 7777
COPY /publish .
COPY /Font/* /usr/share/fonts/truetype/
RUN sed -i 's/http:\/\/deb.debian.org/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
RUN apt update && apt install -y fontconfig && fc-cache -fv
ENTRYPOINT ["dotnet", "Coreqi_api.dll"]

3.查看安装的中文字体

操作必须进入容器中执行bashshell

fc-list :lang=zh