1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-21 01:27:01 +02:00

add playwright

This commit is contained in:
kev 2021-08-04 13:32:37 +08:00
parent 13cc78afb6
commit 2dec76638f
4 changed files with 50 additions and 0 deletions

View File

@ -366,6 +366,7 @@ A collection of delicious docker recipes.
- [x] owncloud
- [x] phpmyadmin
- [x] pihole/pihole
- [x] mcr.microsoft.com/playwright
- [x] portainer/portainer :+1:
- [x] postgres
- [x] postgrest/postgrest

25
playwright/README.md Normal file
View File

@ -0,0 +1,25 @@
playwright
==========
```bash
$ mkdir data
$ chown 1000:1000 data
$ docker-compose up -d
$ docker exec --user root playwright npm install -g playwright
$ alias playwright='docker exec playwright npx playwright'
$ docker exec playwright node example.js
$ playwright pdf https://github.com github.pdf
Navigating to https://github.com
Saving as pdf into github.pdf
$ playwright screenshot --full-page https://github.com github.png
Navigating to https://github.com
Capturing screenshot into github.png
$ tree data
├── example.png
├── github.pdf
└── github.png
```

View File

@ -0,0 +1,9 @@
const { webkit } = require('playwright');
(async () => {
const browser = await webkit.launch();
const page = await browser.newPage();
await page.goto('http://whatsmyuseragent.org/');
await page.screenshot({ path: `example.png` });
await browser.close();
})();

View File

@ -0,0 +1,15 @@
playwright:
image: mcr.microsoft.com/playwright:focal
command: sleep inf
container_name: playwright
user: pwuser
ipc: host
security_opt:
- seccomp=unconfined
volumes:
- ./data:/data
- /usr/lib/node_modules
environment:
- NODE_PATH=/usr/lib/node_modules
working_dir: /data
restart: unless-stopped