0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GCP+Docker環境でpuppeteerのビルドが通らなかったので原因と対処法

Posted at

表題の通り、GCP+Docker環境でpuppeteerのビルドが通らなかったので原因と対処法を備忘録として残しておく。

結論

Dockerfileに以下内容を追加すると直った。

#chromiumのDLをスキップ
ENV PUPPETEER_SKIP_DOWNLOAD=true

何が起きていたか

ビルドのyarn install puppeteerの段階で処理が止まっていた。
原因としてはpuppeteerをinstallすると同時にchromiumもダウンロードしようとする。
このchromiumが容量的に大きく、依存関係のチェックなどでビルドに詰まる可能性が高いとのことだった。
特にGCP+Dockerの構成だとよく起きるらしい。

対象法

  1. まず、puppeteerのinstallの際にchromiumをDLしないよう以下記述をDokcerfileに記載した
#chromiumのDLをスキップ
ENV PUPPETEER_SKIP_DOWNLOAD=true

2.以下内容をDockerfileに追加し、apk側でchromiumをDLするようにした

RUN apk add --no-cache \
      chromium=124.0.6367.78-r0 \

3.以下内容をDockerfileに追加し、apkでDLしたchromiumを使う設定にした

ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

以上でビルドがすんなり通った

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?