加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Nightmare.js与Docker

发布时间:2020-12-16 03:49:56 所属栏目:安全 来源:网络整理
导读:我试图在服务器上运行Nightmare.js.我很清楚它在Linux上无头,需要xvfb.我不明白为什么我在DEBUG模式下继续出现以下错误: nightmare queuing process start +0ms nightmare queueing action "useragent" +3ms nightmare queueing action "goto" for https://

我试图在服务器上运行Nightmare.js.我很清楚它在Linux上无头,需要xvfb.我不明白为什么我在DEBUG模式下继续出现以下错误:

  nightmare queuing process start +0ms
  nightmare queueing action "useragent" +3ms
  nightmare queueing action "goto" for https://news.ycombinator.com +2ms
  nightmare queueing action "cookies" +1ms
  nightmare queueing action "goto" for https://news.ycombinator.com/login +0ms
  nightmare queueing action "type" +1ms
  nightmare queueing action "type" +0ms
  nightmare queueing action "click" +0ms
  nightmare queueing action "wait" +1ms
  nightmare queueing action "goto" for https://news.ycombinator.com/item?id=11878025 +0ms
  nightmare queueing action "click" +0ms
  nightmare queueing action "wait" +1ms
  nightmare running +0ms
  nightmare electron child process exited with code 2: undefined +25ms

这是我的Dockerfile:

FROM node:latest

RUN apt-get update &&
    apt-get install -y 
    xvfb 
    x11-xkb-utils 
    xfonts-100dpi 
    xfonts-75dpi 
    xfonts-scalable 
    xfonts-cyrillic 
    x11-apps 
    clang 
    libdbus-1-dev 
    libgtk2.0-dev 
    libnotify-dev 
    libgnome-keyring-dev 
    libgconf2-dev 
    libasound2-dev 
    libcap-dev 
    libcups2-dev 
    libxtst-dev 
    libxss1 
    libnss3-dev 
    gcc-multilib 
    g++-multilib

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY . /usr/src/app

RUN npm install

CMD DEBUG=nightmare* xvfb-run --server-args="-screen 0 1024x768x24" node tux.js -s hn -m create -p 11878025

有什么想法吗?非常感谢帮助.

最佳答案
你可以做的是将你的所有文件放在一个子目录中,比如app /和你的Dockerfile中:

ADD app/ /usr/src/app/

当然在你的app文件夹中会有env.sh,package.json,tux.js和lib目录

这样,如果您需要添加更多文件,则无需在dockerfile中手动添加它们.

PS:它也适用于COPY

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读