Skip to content

Commit d03715f

Browse files
committed
Fix chrome version
1 parent e231cef commit d03715f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Dockerfile.test

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,23 @@ RUN apt-get update && \
2525
libxss1 \
2626
libxtst6 \
2727
unzip \
28+
jq \
2829
xdg-utils \
2930
zip
3031

3132
ARG CHROME_DEB_LINK
3233

33-
RUN wget -O google-chrome.deb $CHROME_DEB_LINK && \
34-
dpkg -i google-chrome.deb
35-
RUN chrome_version=$(google-chrome --version | grep -oE '[.[0-9]+]*') && \
36-
wget https://storage.googleapis.com/chrome-for-testing-public/$chrome_version/linux64/chromedriver-linux64.zip && \
37-
unzip -jq chromedriver-linux64.zip chromedriver-linux64/chromedriver -d /usr/local/bin/ && \
38-
chmod +x /usr/local/bin/chromedriver
34+
RUN CFT_JSON=https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json && \
35+
CHROME_URL=$(curl -fsSL "$CFT_JSON" | jq -r '.channels.Stable.downloads.chrome[] | select(.platform=="linux64") | .url') && \
36+
DRIVER_URL=$(curl -fsSL "$CFT_JSON" | jq -r '.channels.Stable.downloads.chromedriver[] | select(.platform=="linux64") | .url') && \
37+
curl -fsSL "$CHROME_URL" -o chrome.zip && \
38+
curl -fsSL "$DRIVER_URL" -o chromedriver.zip && \
39+
unzip -q chrome.zip -d /opt && \
40+
unzip -q chromedriver.zip -d /opt && \
41+
ln -s /opt/chrome-linux64/chrome /usr/local/bin/google-chrome && \
42+
ln -s /opt/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver && \
43+
chmod +x /opt/chrome-linux64/chrome /opt/chromedriver-linux64/chromedriver && \
44+
rm -f chrome.zip chromedriver.zip
3945

4046
COPY --chown=homs ./run_tests.sh ./.rubocop.yml ./.rubocop_todo.yml /
4147
COPY --chown=homs ./.rubocop.yml ./.rubocop_todo.yml ./jest.config.js /opt/homs/

0 commit comments

Comments
 (0)