Skip to content

Commit

Permalink
docs: recommend Ubuntu 24.04 in Docker images (#31435)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Aug 12, 2024
1 parent 0d575b4 commit cae779b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 70 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/publish_release_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: "publish release - Docker"

on:
workflow_dispatch:
inputs:
is_release:
required: true
type: boolean
description: "Is this a release image?"

release:
types: [published]

Expand Down Expand Up @@ -45,6 +39,3 @@ jobs:
- name: Login to ACR via OIDC
run: az acr login --name playwright
- run: ./utils/docker/publish_docker.sh stable
if: (github.event_name != 'workflow_dispatch' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release == 'true')
- run: ./utils/docker/publish_docker.sh canary
if: (github.event_name != 'workflow_dispatch' && github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && github.event.inputs.is_release != 'true')
46 changes: 23 additions & 23 deletions docs/src/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
container: mcr.microsoft.com/playwright:v%%VERSION%%-noble
steps:
- task: NodeTool@0
Expand All @@ -318,7 +318,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
container: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
steps:
- task: UsePythonVersion@0
Expand All @@ -340,7 +340,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
container: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
steps:
- task: JavaToolInstaller@0
Expand All @@ -361,7 +361,7 @@ trigger:
pool:
vmImage: ubuntu-latest
container: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
container: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
steps:
- task: UseDotNet@2
Expand All @@ -384,28 +384,28 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
- image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
```

```yml python
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
- image: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
```

```yml java
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
- image: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
```

```yml csharp
executors:
pw-jammy-development:
docker:
- image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
- image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
```

Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures.
Expand All @@ -430,7 +430,7 @@ to run tests on Jenkins.

```groovy js
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright:v%%VERSION%%-jammy' } }
agent { docker { image 'mcr.microsoft.com/playwright:v%%VERSION%%-noble' } }
stages {
stage('e2e-tests') {
steps {
Expand All @@ -444,7 +444,7 @@ pipeline {

```groovy python
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy' } }
agent { docker { image 'mcr.microsoft.com/playwright/python:v%%VERSION%%-noble' } }
stages {
stage('e2e-tests') {
steps {
Expand All @@ -458,7 +458,7 @@ pipeline {

```groovy java
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy' } }
agent { docker { image 'mcr.microsoft.com/playwright/java:v%%VERSION%%-noble' } }
stages {
stage('e2e-tests') {
steps {
Expand All @@ -472,7 +472,7 @@ pipeline {

```groovy csharp
pipeline {
agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy' } }
agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble' } }
stages {
stage('e2e-tests') {
steps {
Expand All @@ -489,19 +489,19 @@ pipeline {
Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.md)).

```yml js
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
```

```yml python
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
```

```yml java
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
```

```yml csharp
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
```

### GitLab CI
Expand All @@ -514,7 +514,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
script:
...
```
Expand All @@ -525,7 +525,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
script:
...
```
Expand All @@ -536,7 +536,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
script:
...
```
Expand All @@ -547,7 +547,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
script:
...
```
Expand All @@ -563,7 +563,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
parallel: 7
script:
- npm ci
Expand All @@ -578,7 +578,7 @@ stages:
tests:
stage: test
image: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
image: mcr.microsoft.com/playwright:v%%VERSION%%-noble
parallel:
matrix:
- PROJECT: ['chromium', 'webkit']
Expand All @@ -594,7 +594,7 @@ To run Playwright tests on Google Cloud Build, use our public Docker image ([see

```yml
steps:
- name: mcr.microsoft.com/playwright:v%%VERSION%%-jammy
- name: mcr.microsoft.com/playwright:v%%VERSION%%-noble
script:
...
env:
Expand Down
28 changes: 13 additions & 15 deletions docs/src/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ This Docker image is intended to be used for testing and development purposes on
### Pull the image

```bash js
docker pull mcr.microsoft.com/playwright:v%%VERSION%%-jammy
docker pull mcr.microsoft.com/playwright:v%%VERSION%%-noble
```

```bash python
docker pull mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy
docker pull mcr.microsoft.com/playwright/python:v%%VERSION%%-noble
```

```bash csharp
docker pull mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy
docker pull mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble
```

```bash java
docker pull mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy
docker pull mcr.microsoft.com/playwright/java:v%%VERSION%%-noble
```

### Run the image
Expand All @@ -42,39 +42,39 @@ By default, the Docker image will use the `root` user to run the browsers. This
On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers.

```bash js
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright:v%%VERSION%%-noble /bin/bash
```

```bash python
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v%%VERSION%%-noble /bin/bash
```

```bash csharp
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble /bin/bash
```

```bash java
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:v%%VERSION%%-noble /bin/bash
```

#### Crawling and scraping

On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it.

```bash js
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:v%%VERSION%%-noble /bin/bash
```

```bash python
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v%%VERSION%%-noble /bin/bash
```

```bash csharp
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v%%VERSION%%-noble /bin/bash
```

```bash java
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v%%VERSION%%-jammy /bin/bash
docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:v%%VERSION%%-noble /bin/bash
```

[`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions:
Expand Down Expand Up @@ -108,9 +108,7 @@ See our [Continuous Integration guides](./ci.md) for sample configs.
See [all available image 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).
- `:v%%VERSION%%` - Playwright v%%VERSION%% release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v%%VERSION%%-noble` - Playwright v%%VERSION%% release docker image based on Ubuntu 24.04 LTS (Noble Numbat).
- `:v%%VERSION%%-jammy` - Playwright v%%VERSION%% release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish).
- `:v%%VERSION%%-focal` - Playwright v%%VERSION%% release docker image based on Ubuntu 20.04 LTS (Focal Fossa).
Expand Down
25 changes: 2 additions & 23 deletions utils/docker/publish_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ if [[ "${RELEASE_CHANNEL}" == "stable" ]]; then
echo "ERROR: cannot publish stable docker with Playwright version '${PW_VERSION}'"
exit 1
fi
elif [[ "${RELEASE_CHANNEL}" == "canary" ]]; then
if [[ "${PW_VERSION}" != *-* ]]; then
echo "ERROR: cannot publish canary docker with Playwright version '${PW_VERSION}'"
exit 1
fi
else
echo "ERROR: unknown release channel - ${RELEASE_CHANNEL}"
echo "Must be either 'stable' or 'canary'"
Expand All @@ -28,36 +23,20 @@ fi

# Ubuntu 20.04
FOCAL_TAGS=(
"next"
"next-focal"
"v${PW_VERSION}-focal"
)

if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
FOCAL_TAGS+=("focal")
fi

# Ubuntu 22.04
JAMMY_TAGS=(
"next-jammy"
"v${PW_VERSION}-jammy"
"v${PW_VERSION}"
)

if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
JAMMY_TAGS+=("latest")
JAMMY_TAGS+=("jammy")
fi

# Ubuntu 24.04
NOBLE_TAGS=(
"next-noble"
"v${PW_VERSION}"
"v${PW_VERSION}-noble"
)

if [[ "$RELEASE_CHANNEL" == "stable" ]]; then
NOBLE_TAGS+=("noble")
fi

tag_and_push() {
local source="$1"
local target="$2"
Expand Down

0 comments on commit cae779b

Please sign in to comment.