mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-12-21 01:27:01 +02:00
add playwright
This commit is contained in:
parent
13cc78afb6
commit
2dec76638f
@ -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
25
playwright/README.md
Normal 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
|
||||
```
|
9
playwright/data/example.js
Normal file
9
playwright/data/example.js
Normal 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();
|
||||
})();
|
15
playwright/docker-compose.yml
Normal file
15
playwright/docker-compose.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user