赞
踩
最近本地测试正常,但是docker打包部署到测试环境后,下载excel文件一直提示格式异常
经过检查,docker打镜像时一般都为精简模式,dockerfile需手动添加提字体配置,否则因字体报错异常,一共2个解决方法:
1.dockerfile增加配置
- RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
- # 添加字体
- && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
- && apk update \
- && apk --no-cache add fontconfig ttf-dejavu \
- && rm -rf /var/cache/apk/*
2.使用easyexcel的wtrite时,添加“inMemory”,参数为true,开启内存处理模式(不推荐,1W数据以内可以考虑,大了很容易OOM)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。