Skip to content

Commit 390867e

Browse files
author
cyrus
committed
bump playwright
1 parent 90aca18 commit 390867e

27 files changed

+159
-211
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ coverage
2424
.eslintcache
2525

2626
# Misc
27-
.DS_Store
27+
.DS_Store
28+
29+
build/*

Dockerfile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
FROM playwright/package
1+
FROM playwright/base
2+
3+
ENV NODE_ENV=production
4+
5+
USER pwuser
6+
7+
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
28

39
WORKDIR /home/pwuser
410

5-
COPY package*.json ./
11+
ARG NPM_LOGLEVEL=info
612

713
COPY . .
814

15+
RUN rm yarn.lock
16+
17+
RUN npm install --loglevel ${NPM_LOGLEVEL} --force
18+
919
CMD [ "node", "build/src/main.js" ]
1020

1121
EXPOSE 3000/tcp
1222

13-

Dockerfile.base

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1 @@
1-
FROM ubuntu:bionic
2-
3-
RUN apt-get update && apt-get install -y curl && \
4-
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
5-
apt-get install -y nodejs
6-
7-
# 2. Install WebKit dependencies
8-
RUN apt-get update && apt-get install -y --no-install-recommends \
9-
libwoff1 \
10-
libopus0 \
11-
libwebp6 \
12-
libwebpdemux2 \
13-
libenchant1c2a \
14-
libgudev-1.0-0 \
15-
libsecret-1-0 \
16-
libhyphen0 \
17-
libgdk-pixbuf2.0-0 \
18-
libegl1 \
19-
libnotify4 \
20-
libxslt1.1 \
21-
libevent-2.1-6 \
22-
libgles2 \
23-
libvpx5 \
24-
libxcomposite1 \
25-
libatk1.0-0 \
26-
libatk-bridge2.0-0 \
27-
libepoxy0 \
28-
libgtk-3-0 \
29-
libharfbuzz-icu0
30-
31-
# 3. Install gstreamer and plugins to support video playback in WebKit.
32-
RUN apt-get update && apt-get install -y --no-install-recommends \
33-
libgstreamer-gl1.0-0 \
34-
libgstreamer-plugins-bad1.0-0 \
35-
gstreamer1.0-plugins-good \
36-
gstreamer1.0-libav
37-
38-
# 4. Install Chromium dependencies
39-
RUN apt-get update && apt-get install -y --no-install-recommends \
40-
libnss3 \
41-
libxss1 \
42-
libasound2 \
43-
libxtst6
44-
45-
# 5. Install Firefox dependencies
46-
RUN apt-get update && apt-get install -y --no-install-recommends \
47-
libdbus-glib-1-2 \
48-
libxt6
49-
50-
# 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
51-
RUN apt-get update && apt-get install -y --no-install-recommends \
52-
ffmpeg
53-
54-
# 7. (Optional) Install XVFB if there's a need to run browsers in headful mode
55-
RUN apt-get update && apt-get install -y --no-install-recommends \
56-
xvfb
57-
58-
# 8. Feature-parity with node.js base images.
59-
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
60-
npm install -g yarn
61-
62-
# Install fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai ...)
63-
RUN apt-get install -y \
64-
fonts-freefont-ttf \
65-
fonts-ipafont-gothic \
66-
fonts-kacst \
67-
fonts-liberation \
68-
fonts-noto-color-emoji \
69-
fonts-thai-tlwg \
70-
fonts-wqy-zenhei \
71-
--no-install-recommends
72-
73-
# Cleanup
74-
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
75-
76-
# Add user so we don't need --no-sandbox.
77-
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser \
78-
&& mkdir -p /home/pwuser/Downloads \
79-
&& chown -R pwuser:pwuser /home/pwuser
80-
81-
# Run everything after as non-privileged user.
82-
USER pwuser
1+
FROM mcr.microsoft.com/playwright:v1.16.3-focal

Dockerfile.package

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -144,36 +144,14 @@ Set this value if browser server need to be close after specified time.
144144
## Build All
145145

146146
```
147-
148147
npm run build
149-
docker build --rm -f Dockerfile.base -t playwright/base .
150-
docker build --rm -f Dockerfile.package -t playwright/package .
151-
docker build --rm -f Dockerfile -t playwright/server .
152-
153-
```
154148
155-
## Update playwright
156-
157-
Before update make sure to stop `playwright/server` container and remove both `playwright/server` and 'playwright/package' images.
158-
159-
Update to the latest playwright version:
160-
161-
```
149+
Important: Change playwright version in Dockerfile.base to match installed package
162150
163-
npm run build
164-
docker build --rm -f Dockerfile.package -t playwright/package .
165-
docker build --rm -f Dockerfile -t playwright/server .
166-
167-
```
168-
169-
Update to the specific playwright version:
151+
docker build --rm -f Dockerfile.base -t playwright/base .
152+
docker build --progress=plain --rm -f Dockerfile -t playwright/server .
170153
171154
```
172-
docker build --rm -f Dockerfile.package -t playwright/package --build-arg PLAYWRIGHT_VERSION=0.11.1 .
173-
docker build --rm -f Dockerfile -t playwright/server .
174-
```
175-
176-
> To set nodejs --loglevel use NPM_LOGLEVEL variable
177155

178156
## Debugging
179157

build/src/browser.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/browser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/proxy.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/proxy.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/src/server.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)