puppeteer/browsers docker 安装备忘

https://pptr.dev/troubleshooting#running-puppeteer-on-gitlabci

1.内容中,缺少libgbm-dev,补充上

FROM node:18.9.0-slim
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
    #echo "" >>/etc/apt/sources.list 
    sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list

WORKDIR /opt/app
ADD app/package.json /tmp/package.json

RUN apt-get update && apt-get install -yq libgbm-dev gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release xdg-utils wget
RUN cd /tmp &&  npm install && mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/ && npx @puppeteer/browsers install chrome@117 --platform linux --path /opt/.local-chromium
ADD . /opt/app/



CMD ["node", "index.js"]

2.和安装执行的系统版本有关,在debian9.5情况下,会出现依赖文件无法安装,大概如下:

dockerfile 安装gconf-service时出现 errors were encountered while processing:
gconf2-common
gconf-service
libgconf-2-4:amd64
E:sub-process /usr/bin.dpkg returned an error code

creating config file /etc/gconf/2/path with new version
stat:connot statx 'usr/share/gconf/default.path':operation noet permitted

dpkg:error processing package gconf2-common(--configure):
installed gconf2=common package post-installation script subprocess returned error exit status 1

dockerfile 安装gconf-server 时出现:
dpkg:dependency problem prevent configuration of libconf-2-4:amd64:
libgconf-2-:amd64 depends on gconf2-common(=3.2.6-7);however:
package gconf2-common is not c onfigured yet.

dpkg:error processing package libgconf-2-4:amd64(--configure):
dependency problems - leaving unconfigured

 errors were encountered while processing:
gconf2-common
gconf-service
libgconf-2-4:amd64
E:sub-process /usr/bin.dpkg returned an error code

debconf:delaying package configuration,since apt-utils is not installed

但系统升级为debian10以上后,正常安装。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值