【文件属性】:
文件名称:try-puppeteer:在云中运行Puppeteer代码
文件大小:54KB
文件格式:ZIP
更新时间:2021-02-02 09:01:24
docker node appengine headless-chrome puppeteer
试试木偶!
在云中运行脚本。
试试看: :
开发
安装:
yarn ; yarn install-backend
# or npm i
后端
后端是一个Docker容器,该容器安装了可在Linux上与Puppeteer一起使用的最新Chrome程序包。
注意:在尝试本节中的每个步骤之前,您需要运行Docker。
建立它
yarn build
运行容器
容器可以两种方式运行:作为可执行文件独立运行或作为Web服务独立运行。
1.使用独立的CLI
第一种是“独立”模式,可从CLI运行Puppeteer脚本。 它以脚本文件作为参数,并在容器中运行它。
./backend/run_puppeteer.sh your-puppeteer-script.js
2.运行Web服务
第二个选项是将容器作为Web服务器运行。 端点接受文件上传以在云中运行您的Puppeteer脚本:
启动服务器:
cd backend
yarn serve
# yarn restart is handy too. It rebuilds the container and starts the se
【文件预览】:
try-puppeteer-master
----.gitignore(53B)
----package.json(743B)
----LICENSE(11KB)
----public()
--------app.js(7KB)
--------images()
--------cycler-element.js(1KB)
--------index.html(6KB)
--------styles.css(6KB)
----.gitmodules(107B)
----.gcloudignore(537B)
----.eslintrc.js(860B)
----README.md(3KB)
----backend()
--------Dockerfile(3KB)
--------package.json(597B)
--------src()
--------.dockerignore(113B)
--------puppeteer()
--------build.sh(88B)
--------app.yaml(221B)
--------run_puppeteer.sh(344B)
--------server.js(9KB)
--------yarn.lock(20KB)
----app.yaml(17B)
----server.js(1KB)
----yarn.lock(46KB)