FROM java:8-jre
MAINTAINER [email protected]
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 3.将我们准备的fonts字体,拷贝到/usr/share/fonts下面
RUN mkdir -p /usr/share/fonts
RUN mkdir -p /usr/share/fonts/zh
COPY ./fonts /usr/share/fonts/zh
RUN cd /usr/share/fonts/zh && \
chmod -R 755 /usr/share/fonts && \
chmod -R 755 /usr/share/fonts/zh && \
# 4.安装字体
yum install mkfontscale fontconfig -y && \
mkfontscale && \
mkfontdir && \
fc-cache -fv
# 验证(这个构建好镜像后运行执行)
RUN fc-list :lang=zh
RUN mkdir -p /xxx
WORKDIR /xxx
ADD ./jar/xxx.jar ./
CMD java -Djava.security.egd=file:/dev/./urandom -jar -Duser.timezone=GMT+08 xxx.jar
或者
2. 在中文字体库安装目录下创建软链接:
$ ln -sf /usr/share/fonts/truetype/wqy/wqy-zenhei.ttf /usr/share/fonts/truetype/wqy-zenhei.ttf
FROM openjdk:8u332-oraclelinux7 #RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories #RUN apk add --update font-adobe-100dpi ttf-dejavu fontconfig #在线安装字体 #RUN yum -y install wget #RUN wget -O /usr/share/fonts/simsun.ttf https://pfh-file-store.oss-cn-hangzhou.aliyuncs.com/simsun.ttf #RUN fc-cache -vf #RUN fc-list #离线安装字体,先把离线字体文件加入dockerfile目录 COPY front/simsun.ttf /usr/share/fonts/simsun.ttf #RUN mkfontscale #RUN mkfontdir RUN fc-cache -vf RUN fc-list标签:RUN,fonts,share,usr,&&,ppt,pdf,Dockerfile,ttf From: https://www.cnblogs.com/wjsqqj/p/17714514.html