From 7e6072583bc7cfc3fa26b6c39e3ef961cd216d8f Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 16 Jan 2024 19:27:17 +0100 Subject: [PATCH] docs(docker): various enhancements (#28994) Fixes https://github.com/microsoft/playwright-python/issues/2241 --- docs/src/docker.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/docs/src/docker.md b/docs/src/docker.md index 98e3f4d860..a171f60a0d 100644 --- a/docs/src/docker.md +++ b/docs/src/docker.md @@ -5,7 +5,7 @@ title: "Docker" ## Introduction -[Dockerfile.jammy] can be used to run Playwright scripts in Docker environment. These image includes all the dependencies needed to run browsers in a Docker container, and also include the browsers themselves. +[Dockerfile.jammy] can be used to run Playwright scripts in Docker environment. These image includes the [Playwright browsers](./browsers.md#install-browsers) and [browser system dependencies](./browsers.md#install-system-dependencies). The Playwright package/dependency is not included in the image and should be installed separately. ## Usage @@ -107,8 +107,7 @@ See our [Continuous Integration guides](./ci.md) for sample configs. See [all available image tags]. -Docker images are published automatically by GitHub Actions. We currently publish images with the -following tags: +We currently publish images with the following tags: - `:next` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish). - `:next-jammy` - tip-of-tree image version based on Ubuntu 22.04 LTS (Jammy Jellyfish). - `:v%%VERSION%%` - Playwright v%%VERSION%% release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). @@ -140,11 +139,9 @@ You can use the [.NET install script](https://learn.microsoft.com/en-us/dotnet/c curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --install-dir /usr/share/dotnet --channel 6.0 ``` -## Development +## Build your own image * langs: js -### Build the image - To run Playwright inside Docker, you need to have Node.js, [Playwright browsers](./browsers.md#install-browsers) and [browser system dependencies](./browsers.md#install-system-dependencies) installed. See the following Dockerfile: ```Dockerfile @@ -153,15 +150,14 @@ FROM node:20-bookworm RUN npx -y playwright@%%VERSION%% install --with-deps ``` -Note: official images published to [Microsoft Artifact Registry] are built using [`//utils/docker/build.sh`](https://github.com/microsoft/playwright/blob/main/utils/docker/build.sh) script. +## Build your own image +* langs: python -```txt -./utils/docker/build.sh jammy playwright:localbuild-jammy +To run Playwright inside Docker, you need to have Python, [Playwright browsers](./browsers.md#install-browsers) and [browser system dependencies](./browsers.md#install-system-dependencies) installed. See the following Dockerfile: + +```Dockerfile +FROM python:3.12-bookworm + +RUN pip install playwright==@%%VERSION%% && \ + playwright install --with-deps ``` - -The image will be tagged as `playwright:localbuild-jammy` and could be run as: - -```txt -docker run --rm -it playwright:localbuild /bin/bash -``` -