Skip to content

Commit

Permalink
chore: update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
devcorpio committed Sep 22, 2023
1 parent 6b59a03 commit 5fd390e
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 42 deletions.
64 changes: 34 additions & 30 deletions .ci/docker/node-playwright/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
#Dockerfile for docker.elastic.co/observability-ci/node-playwright:${NODEJS_VERSION}
# When changing Node version, please build the Docker image for RUM here:
# https://apm-ci.elastic.co/job/apm-shared/job/apm-docker-images-pipeline/build?delay=0sec
# Remember checking the 'rum' parameter
# Little bit customized version of microsoft/playwright:bionic image
ARG NODEJS_VERSION
FROM ubuntu:bionic
FROM ubuntu:jammy
# this second declaration is needed because ARG before FROM works differently. See https://docs.docker.com/compose/compose-file/#args
ARG NODEJS_VERSION

# 1. Install node
RUN apt-get -qq update && apt-get -qq install -y curl && \
curl -sL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | bash - && \
apt-get -qq install -y nodejs
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODEJS_VERSION.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install nodejs -y && \
rm -rf /etc/apt/keyrings && rm /etc/apt/sources.list.d/nodesource.list

# 2. Install git (used to tag commit in benchmark runner)
RUN apt-get -qq install -y git --no-install-recommends

# 3. Install Browser (Chrome, Firefox and Webkit) dependencies
# 2. Install Browser (Chrome, Firefox and Webkit) dependencies
RUN apt-get -qq install -y --no-install-recommends \
fonts-liberation \
libasound2 \
Expand Down Expand Up @@ -45,15 +42,15 @@ RUN apt-get -qq install -y --no-install-recommends \
libxshmfence1 \
xvfb \
fonts-noto-color-emoji \
ttf-unifont \
fonts-unifont \
libfontconfig \
libfreetype6 \
xfonts-cyrillic \
xfonts-scalable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-tlwg-loma-otf \
ttf-ubuntu-font-family \
fonts-freefont-ttf \
ffmpeg \
libcairo-gobject2 \
libdbus-glib-1-2 \
Expand All @@ -71,7 +68,7 @@ RUN apt-get -qq install -y --no-install-recommends \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
libbrotli1 \
libenchant1c2a \
libenchant-2-dev \
libepoxy0 \
libevdev2 \
libgl1 \
Expand All @@ -81,35 +78,42 @@ RUN apt-get -qq install -y --no-install-recommends \
libharfbuzz-icu0 \
libharfbuzz0b \
libhyphen0 \
libicu60 \
libicu-dev \
libjpeg-turbo8 \
libnotify4 \
libopenjp2-7 \
libopus0 \
libpng16-16 \
libsecret-1-0 \
libvpx5 \
libvpx-dev \
libwayland-client0 \
libwayland-egl1 \
libwayland-server0 \
libwebp6 \
libwebp-dev \
libwebpdemux2 \
libwoff1 \
libxkbcommon0 \
libxml2 \
libxslt1.1

# 4. Install Chrome stable to run karma benchmark tests inside puppeteer
# 3. Install Chromium to run karma benchmark tests inside puppeteer
# before we were using the Chrome unstable, but with the unstable one the benchmarks were failing, karma launcher was crashing.
# The error was "Cannot start ChromeHeadless", no more details were provided by the tool.
RUN apt-get -qq install -y wget --no-install-recommends \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get -qq update \
&& apt-get -qq install -y \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
--no-install-recommends
RUN apt-get -qq install -y \
chromium-browser \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
--no-install-recommends

# 4. the node-gyp we use is only compatible with Python versions less than 3.10,
# so we need to make sure we use a previous version
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq install -y software-properties-common g++ build-essential && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get -qq install -y python3.9

# 4.1 make python 3.9 the default version (for python and for python3)
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
53 changes: 41 additions & 12 deletions .ci/docker/node-puppeteer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
#Dockerfile for docker.elastic.co/observability-ci/node-puppeteer:12
# When changing Node version, please build the Docker image for RUM here:
# https://apm-ci.elastic.co/job/apm-shared/job/apm-docker-images-pipeline/build?delay=0sec
# Remember checking the 'rum' parameter
ARG NODEJS_VERSION
FROM node:${NODEJS_VERSION}
FROM ubuntu:jammy
# this second declaration is needed because ARG before FROM works differently. See https://docs.docker.com/compose/compose-file/#args
ARG NODEJS_VERSION

# 1. Install node
RUN apt-get update && apt-get install -y ca-certificates curl gnupg && \
mkdir -p /etc/apt/keyrings && \
curl -sL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODEJS_VERSION.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && apt-get install nodejs -y && \
rm -rf /etc/apt/keyrings && rm /etc/apt/sources.list.d/nodesource.list

# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
RUN apt-get update \
&& apt-get install -y \
google-chrome-unstable \
chromium-browser \
libxss1 \
libxtst6 \
libnspr4 \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libxkbcommon0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libasound2 \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
--no-install-recommends


# the node-gyp we use is only compatible with Python versions less than 3.10,
# so we need to make sure we use a previous version
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq install -y software-properties-common g++ build-essential && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get -qq install -y python3.9

# 4.1 make python 3.9 the default version (for python and for python3)
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1

# Always put COPY instructions at the end, so that Docker will reuse the above layers on builds
COPY run-test.sh /run-test.sh
COPY run-test.sh /run-test.sh

0 comments on commit 5fd390e

Please sign in to comment.