chore(docker): put browser deps instructions first (#4637)

This commit is contained in:
Yury Semikhatsky 2020-12-08 10:36:37 -08:00 committed by GitHub
parent c1dcef39a3
commit 6c4d3b86f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 27 deletions

View file

@ -1,11 +1,8 @@
FROM ubuntu:bionic FROM ubuntu:bionic
# 1. Install node14 # === INSTALL BROWSER DEPENDENCIES ===
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# 2. Install WebKit dependencies # Install WebKit dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libwoff1 \ libwoff1 \
libopus0 \ libopus0 \
@ -29,14 +26,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgtk-3-0 \ libgtk-3-0 \
libharfbuzz-icu0 libharfbuzz-icu0
# 3. Install gstreamer and plugins to support video playback in WebKit. # Install gstreamer and plugins to support video playback in WebKit.
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libgstreamer-gl1.0-0 \ libgstreamer-gl1.0-0 \
libgstreamer-plugins-bad1.0-0 \ libgstreamer-plugins-bad1.0-0 \
gstreamer1.0-plugins-good \ gstreamer1.0-plugins-good \
gstreamer1.0-libav gstreamer1.0-libav
# 4. Install Chromium dependencies # Install Chromium dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 \ libnss3 \
libxss1 \ libxss1 \
@ -44,24 +41,31 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
fonts-noto-color-emoji \ fonts-noto-color-emoji \
libxtst6 libxtst6
# 5. Install Firefox dependencies # Install Firefox dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-glib-1-2 \ libdbus-glib-1-2 \
libxt6 libxt6
# 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox. # Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg ffmpeg
# 7. (Optional) Install XVFB if there's a need to run browsers in headful mode # (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb xvfb
# 8. Feature-parity with node.js base images. # === INSTALL Node.js ===
# Install node14
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# Feature-parity with node.js base images.
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \ RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
npm install -g yarn npm install -g yarn
# 9. Create the pwuser (we internally create a symlink for the pwuser and the root user) # Create the pwuser (we internally create a symlink for the pwuser and the root user)
RUN adduser pwuser RUN adduser pwuser
# === BAKE BROWSERS INTO IMAGE === # === BAKE BROWSERS INTO IMAGE ===

View file

@ -1,11 +1,8 @@
FROM ubuntu:focal FROM ubuntu:focal
# 1. Install node14 # === INSTALL BROWSER DEPENDENCIES ===
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# 2. Install WebKit dependencies # Install WebKit dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libwoff1 \ libwoff1 \
libopus0 \ libopus0 \
@ -28,14 +25,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgtk-3-0 \ libgtk-3-0 \
libharfbuzz-icu0 libharfbuzz-icu0
# 3. Install gstreamer and plugins to support video playback in WebKit. # Install gstreamer and plugins to support video playback in WebKit.
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libgstreamer-gl1.0-0 \ libgstreamer-gl1.0-0 \
libgstreamer-plugins-bad1.0-0 \ libgstreamer-plugins-bad1.0-0 \
gstreamer1.0-plugins-good \ gstreamer1.0-plugins-good \
gstreamer1.0-libav gstreamer1.0-libav
# 4. Install Chromium dependencies # Install Chromium dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 \ libnss3 \
libxss1 \ libxss1 \
@ -43,24 +40,31 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
fonts-noto-color-emoji \ fonts-noto-color-emoji \
libxtst6 libxtst6
# 5. Install Firefox dependencies # Install Firefox dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-glib-1-2 \ libdbus-glib-1-2 \
libxt6 libxt6
# 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox. # Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg ffmpeg
# 7. (Optional) Install XVFB if there's a need to run browsers in headful mode # (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb xvfb
# 8. Feature-parity with node.js base images. # === INSTALL Node.js ===
# Install node14
RUN apt-get update && apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
# Feature-parity with node.js base images.
RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \ RUN apt-get update && apt-get install -y --no-install-recommends git ssh && \
npm install -g yarn npm install -g yarn
# 9. Create the pwuser (we internally create a symlink for the pwuser and the root user) # Create the pwuser (we internally create a symlink for the pwuser and the root user)
RUN adduser pwuser RUN adduser pwuser
# === BAKE BROWSERS INTO IMAGE === # === BAKE BROWSERS INTO IMAGE ===

View file

@ -3,12 +3,12 @@ set -e
set +x set +x
if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then if [[ ($1 == '--help') || ($1 == '-h') || ($1 == '') || ($2 == '') ]]; then
echo "usage: $(basename $0) {bionic,focal} playwright:localbuild-bionic" echo "usage: $(basename $0) {bionic,focal} playwright:localbuild-focal"
echo echo
echo "Build Playwright docker image and tag it as 'playwright:localbuild-bionic'." echo "Build Playwright docker image and tag it as 'playwright:localbuild-focal'."
echo "Once image is built, you can run it with" echo "Once image is built, you can run it with"
echo "" echo ""
echo " docker run --rm -it playwright:localbuildbionic /bin/bash" echo " docker run --rm -it playwright:localbuild-focal /bin/bash"
echo "" echo ""
echo "NOTE: this requires on Playwright dependencies to be installed with 'npm install'" echo "NOTE: this requires on Playwright dependencies to be installed with 'npm install'"
echo " and Playwright itself being built with 'npm run build'" echo " and Playwright itself being built with 'npm run build'"