Home > Blockchain >  Docker and playwright
Docker and playwright

Time:02-10

Hi i have a instrucions that i need to isntall playwright inside of docker.

This is my dockerfile

FROM python:3.9

EXPOSE 8000

WORKDIR /fastanalytics

COPY /requirements.txt /fastanalytics/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /fastanalytics/requirements.txt

RUN playwright install
RUN playwright install-deps
RUN apt-get update && apt-get upgrade -y

But when i am installing i got this, i tried run install everything that wrote in this error, but didnt help

E: Package 'ttf-ubuntu-font-family' has no installation candidate
E: Unable to locate package libenchant1c2a
E: Unable to locate package libicu66
E: Package 'libjpeg-turbo8' has no installation candidate

enter image description here

CodePudding user response:

RUN apt-get update && playwright install-deps

While I have not used playwright, this seems to be a Docker issue. Playwright seems to be using apt-get to install the dependencies. In that case, you need to ensure apt-get update is run before playwright install-deps. While you can use two separate RUN statements to accomplish this, it is not advisable sinceapt-get update may not be run because of Docker's caching capabilities.

CodePudding user response:

Based on their docs (https://playwright.dev/python/docs/cli#install-system-dependencies), it looks like they only officially support Ubuntu systems whereas the python:3.9 is based off of Debian. Try using Ubuntu as your base image and install python on it:

FROM ubuntu:20.04

RUN apt update
RUN apt install python3.9

...
  • Related