将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/localtime

EXPOSE 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

相关推荐

  1. phantomjs制成docker镜像

    2024-02-21 20:54:02       56 阅读
  2. Docker jenkins 镜像制作

    2024-02-21 20:54:02       64 阅读
  3. docker制作zookeeper镜像

    2024-02-21 20:54:02       35 阅读
  4. Linux制作docker镜像

    2024-02-21 20:54:02       27 阅读
  5. tengine-docker镜像制作

    2024-02-21 20:54:02       33 阅读
  6. Docker镜像制作之ZLMediakit镜像制作

    2024-02-21 20:54:02       56 阅读
  7. Seatunnel Docker image镜像制作

    2024-02-21 20:54:02       48 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-02-21 20:54:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-21 20:54:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-02-21 20:54:02       87 阅读
  4. Python语言-面向对象

    2024-02-21 20:54:02       97 阅读

热门阅读

  1. C语言读取文件夹一级子目录的指定类型文件

    2024-02-21 20:54:02       62 阅读
  2. 漫谈C与C++(《Effictive C++》/关于函数重载)

    2024-02-21 20:54:02       49 阅读
  3. C Primer Plus(第六版)16.18 编程练习 第5题

    2024-02-21 20:54:02       49 阅读
  4. C语言:密码强度

    2024-02-21 20:54:02       46 阅读
  5. C语言----数组

    2024-02-21 20:54:02       46 阅读
  6. Node响应Vue axios请求方法说明

    2024-02-21 20:54:02       43 阅读
  7. Git面试题整理(对比)

    2024-02-21 20:54:02       43 阅读
  8. C语言—自定义(构造)类型

    2024-02-21 20:54:02       49 阅读