From 4eb816af2079339a426d0a3b87849d68cb948b56 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Fri, 19 Apr 2024 07:52:47 +0700 Subject: [PATCH] build: support download older Chrome version (#2216) E.g: given --build-arg CHROME_VERSION=google-chrome-stable_119.0.6045.159-1 Find list versions at https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable Signed-off-by: Viet Nguyen Duc --- NodeChrome/Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/NodeChrome/Dockerfile b/NodeChrome/Dockerfile index 432265f91..41f4c57ef 100644 --- a/NodeChrome/Dockerfile +++ b/NodeChrome/Dockerfile @@ -15,11 +15,18 @@ USER root # google-chrome-unstable #============================================ ARG CHROME_VERSION="google-chrome-stable" +ARG TARGETARCH=amd64 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor | tee /etc/apt/trusted.gpg.d/google.gpg >/dev/null \ && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \ && apt-get update -qqy \ - && apt-get -qqy --no-install-recommends install \ - ${CHROME_VERSION:-google-chrome-stable} \ + && if echo "${CHROME_VERSION}" | grep -qE "google-chrome-stable_[0-9]*"; \ + then \ + wget -qO google-chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_VERSION}_${TARGETARCH}.deb" \ + && apt-get -qqy --no-install-recommends install --allow-downgrades ./google-chrome.deb \ + && rm -rf google-chrome.deb ; \ + else \ + apt-get -qqy --no-install-recommends install ${CHROME_VERSION} ; \ + fi \ && rm /etc/apt/sources.list.d/google-chrome.list \ && rm -rf /var/lib/apt/lists/* /var/cache/apt/*