Kiran Kumar
Kiran Kumar

Reputation: 1

How to add chrome browser to TestCafe docker image?

TestCafe docker image is having only chromium,firefox. I want use same image to run tests on chrome & tried to build docker image by installing chrome browser using testcafe base image (linux/amd64). But running into issues. docker run -v ${PWD}/tests:/tests -it testcafe/testcafe chromium,firefox tests/shared/abc.js https://devexpress.github.io/testcafe/documentation/guides/advanced-guides/use-testcafe-docker-image.html#test-in-docker-containers apt-get is the package manager for Ubuntu and other Debian-based distros, apk for Alpine for my base image type linux/amd64(https://hub.docker.com/r/testcafe/testcafe/tags?page=1&ordering=last_updated)

ERROR [2/5] RUN apk update && apk add --no-cache ERROR [2/5] RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo dpkg -i google-chrome-stable_current_amd64.deb

Was trying like below in docker file:(Not sure exact preprequisites section & install Chrome section) #Step 0: Choose base FROM testcafe/testcafe #Step 1 : Install the pre-requisite RUN apk update RUN apt-get install -y curl RUN apt-get install -y p7zip
p7zip-full
unace
zip
unzip
bzip2

#Version numbers ARG CHROME_VERSION=89.0.4389.114

#Step 2: Install Chrome RUN curl http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_$CHROME_VERSION-1_amd64.deb -o /chrome.deb RUN dpkg -i /chrome.deb RUN rm /chrome.deb

CMD ["echo", " hello, Welcome to Kiran's custom testcafe docker image!"]

Appreciate if anyone suggest commands in docker file for this object.

Upvotes: 0

Views: 1244

Answers (1)

vasily.strelyaev
vasily.strelyaev

Reputation: 838

Unfortunately, there seems to be no reliable way to install Google Chrome on Alpine Linux. The dpkg package used in your example is intended for Debian-based distributions. While it is available on Alpine Linux as well, it is usually good for lightweight packages only. With heavy packages, it is likely to fail because some of its dependencies are unavailable on Alpine.

That is why the apk package manager is preferred for Alpine Linux. However, google-chrome is not available for apk (only chromium is). See https://stackoverflow.com/a/58781506.

If you need to use a full-featured google-chrome for testing, please consider using a Debian-based Docker image instead of the Alpine-based TestCafe image.

Upvotes: 1

Related Questions