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?

DockerコンテナでPlaywright(Python)を利用するときの依存関係解決方法 覚え書き

Last updated at Posted at 2025-01-27

問題

DockerでPlaywrightをインストールするときに依存関係でエラーが起こる。
関係する全てのパッケージを手動でapt-getに記載して解決する手法が多いが、元にするイメージによっては途方もない量のパッケージが必要となっていた。

解決策

playwright install-depsを利用する。
以下のように依存関係をインストールするコマンドをDockerfileに追記するだけで良い感じに解決してくれる。

FROM python:3.11-slim

WORKDIR /app

RUN apt-get update && apt-get install -y libffi-dev
COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

RUN playwright install
RUN playwright install-deps #依存関係のインストール 
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?