山东城乡建设厅网站,广告在线设计网站,建网站 多少钱钱,asp网站建设教程几个前的一篇文章中介绍了phantomjsecharts生成图表图片的一种方式#xff0c;但其部署复杂#xff0c;制作为docker镜像运行就方便多了。文章参见#xff1a;https://blog.csdn.net/u011943534/article/details/121524397
1、准备echarts
将上次文章中提到过下载的Echart…几个前的一篇文章中介绍了phantomjsecharts生成图表图片的一种方式但其部署复杂制作为docker镜像运行就方便多了。文章参见https://blog.csdn.net/u011943534/article/details/121524397
1、准备echarts
将上次文章中提到过下载的EchartsConvert 解压并复制到一个安装docker的服务器。 下载地址https://gitee.com/saintlee/echartsconvert
2、准备phantomjs
将上次文章中个体到过下载的phantomjs解压并复制bin目录下的phantomjs文件到上一步和echarts相同的目录
下载地址https://bitbucket.org/ariya/phantomjs/downloads/ 注意下载linux版本的
3、编写dockerfile
FROM debian:stable-slim
RUN apt-get update
RUN apt-get install -y apt-transport-https ca-certificates#mirror
COPY sources.list /etc/apt/sources.list#phantomjs
RUN apt-get update
RUN apt-get install -y libfontconfig1
ENV OPENSSL_CONF /etc/ssl/
COPY phantomjs /usr/local/bin
RUN chmod x /usr/local/bin/phantomjs
ADD echartsconvert-master /echartsconvert-master
RUN apt-get install -y ttf-wqy-zenhei
RUN apt-get install -y xfonts-intl-chinese wqy*
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtimeEXPOSE 7777
CMD [/usr/local/bin/phantomjs, /echartsconvert-master/echarts-convert.js, -s, -p, 7777]
其中sources.list如下
deb https://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye main non-free contrib
deb https://mirrors.tencent.com/debian-security/ bullseye-security main
deb-src https://mirrors.tencent.com/debian-security/ bullseye-security main
deb https://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.tencent.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.tencent.com/debian/ bullseye-backports main non-free contrib4、构建镜像
docker build -t phantomjs:0.0.1 .5、运行镜像
docker run -d --namephantomjs --restartalways -p 7777:7777 phantomjs:0.0.1