当前位置: 首页 > news >正文

将phantomjs制成docker镜像

几个前的一篇文章中介绍了phantomjs+echarts生成图表图片的一种方式,但其部署复杂,制作为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 contrib

4、构建镜像

docker build -t phantomjs:0.0.1 .

5、运行镜像

docker run -d --name=phantomjs --restart=always -p 7777:7777 phantomjs:0.0.1
http://www.lryc.cn/news/302770.html

相关文章:

  • 【LeetCode+JavaGuide打卡】Day20|530.二叉搜索树的最小绝对差、501.二叉搜索树中的众数、236. 二叉树的最近公共祖先
  • 【工具类】开源照片管理工具pthtoprism
  • [ linux网络 ] 网关服务器搭建,综合应用SNAT、DNAT转换,dhcp分配、dns分离解析,nfs网络共享以及ssh免密登录
  • MySQL全量备份
  • 【Linux系统化学习】动静态库 | 软硬链接
  • linux-firewalld防火墙端口转发
  • adobe软件提示This non-genuine Adobe app will be disabled soon【软件版本】
  • python coding with ChatGPT 打卡第20天| 二叉搜索树:搜索、验证、最小绝对差、众数
  • Stable Diffusion——基础模型、VAE、LORA、Embedding各个模型的介绍与使用方法
  • Python自动化部署与配置管理:Ansible与Docker
  • 《摔跤吧爸爸》19岁女星突患皮肌炎离世
  • 用结构体数组,完成宠物信息登记管理。
  • 频率主义线性回归和贝叶斯线性回归
  • 【感知算法】Dempster-Shafer理论(下)
  • 通过conda安装cudatoolikit和cudnn
  • vue中使用jsx语法
  • 我的NPI项目之Android USB 系列(一) - 遥望和USB的相识
  • K8s进阶之路-命名空间级-服务发现 :
  • 智慧公厕管理系统:让城市智慧驿站更加智慧舒适
  • 图形渲染基础学习
  • 每日学习总结20240219
  • K8s进阶之路-安装部署K8s
  • springboot集成elk实现日志采集可视化
  • leetcode 148. 排序链表 java解法
  • 【MATLAB源码-第140期】基于matlab的深度学习的两用户NOMA-OFDM系统信道估计仿真,对比LS,MMSE,ML。
  • 运动重定向学习笔记
  • 导出Excel,支持最佳
  • 【WPF】获取父控件数据
  • 解决Edge浏览器,微博无法查看大图(Edge Image Viewer)
  • PMP含金量在国内怎么样?