mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-13 17:14:02 +03:00
feat: add a playwright-ready docker image (#1161)
This commit is contained in:
parent
4af4557706
commit
1781ae7006
50
docs/docker/Dockerfile.bionic
Normal file
50
docs/docker/Dockerfile.bionic
Normal file
@ -0,0 +1,50 @@
|
||||
################################################
|
||||
# Compile with:
|
||||
# sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
|
||||
#
|
||||
# Run with:
|
||||
# sudo docker run -d -p --rm --name playwright microsoft/playwright:bionic
|
||||
#
|
||||
#################################################
|
||||
|
||||
FROM ubuntu:bionic
|
||||
|
||||
# 1. Install node12
|
||||
RUN apt-get update && apt-get install -y curl && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
|
||||
apt-get install -y nodejs
|
||||
|
||||
# 2. Install WebKit dependencies
|
||||
RUN apt-get install -y libwoff1 \
|
||||
libopus0 \
|
||||
libwebp6 \
|
||||
libwebpdemux2 \
|
||||
libenchant1c2a \
|
||||
libgudev-1.0-0 \
|
||||
libsecret-1-0 \
|
||||
libhyphen0 \
|
||||
libgdk-pixbuf2.0-0 \
|
||||
libegl1 \
|
||||
libnotify4 \
|
||||
libxslt1.1 \
|
||||
libevent-2.1-6 \
|
||||
libgles2 \
|
||||
libvpx5
|
||||
|
||||
# 3. Install Chromium dependencies
|
||||
|
||||
RUN apt-get install -y libnss3 \
|
||||
libxss1 \
|
||||
libasound2
|
||||
|
||||
# 4. Install Firefox dependencies
|
||||
|
||||
RUN apt-get install -y libdbus-glib-1-2
|
||||
|
||||
# 5. Add user so we don't need --no-sandbox in Chromium
|
||||
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
|
||||
&& mkdir -p /home/pwuser/Downloads \
|
||||
&& chown -R pwuser:pwuser /home/pwuser
|
||||
|
||||
# Run everything after as non-privileged user.
|
||||
USER pwuser
|
21
docs/docker/README.md
Normal file
21
docs/docker/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Running Playwright in Docker
|
||||
|
||||
`Dockerfile.bionic` is a playwright-ready image of playwright.
|
||||
This image includes all the dependencies needed to run browsers in a Docker
|
||||
container.
|
||||
|
||||
Building image:
|
||||
|
||||
```
|
||||
$ sudo docker build -t microsoft/playwright:bionic -f Dockerfile.bionic .
|
||||
```
|
||||
|
||||
Running image:
|
||||
|
||||
```
|
||||
$ sudo docker container run -it --rm --security-opt seccomp=chrome.json microsoft/playwright /bin/bash
|
||||
```
|
||||
|
||||
> **NOTE**: The seccomp profile is coming from Jessie Frazelle. It's needed
|
||||
> to run Chrome without sandbox.
|
||||
|
1535
docs/docker/chrome.json
Normal file
1535
docs/docker/chrome.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user