Skip to content

Commit b0089c5

Browse files
authored
chore: Prepare Dockerfile for Recaptcha tests (#9177)
1 parent 145036e commit b0089c5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

.kokoro/docker/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,21 @@ RUN useradd -d /h -u ${UID} ${USERNAME}
202202
# Allow nopasswd sudo
203203
RUN echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
204204

205+
# Install Chrome.
206+
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub -o /tmp/google.pub \
207+
&& cat /tmp/google.pub | apt-key add -; rm /tmp/google.pub \
208+
&& echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google.list \
209+
&& mkdir -p /usr/share/desktop-directories \
210+
&& apt-get -y update && apt-get install -y google-chrome-stable
211+
212+
# Disable the SUID sandbox so that Chrome can launch without being in a privileged container.
213+
RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome \
214+
&& echo "#!/bin/bash\nexec /opt/google/chrome/google-chrome.real --no-sandbox --disable-setuid-sandbox \"\$@\"" > /opt/google/chrome/google-chrome \
215+
&& chmod 755 /opt/google/chrome/google-chrome
216+
217+
# Install Chrome Driver.
218+
RUN mkdir -p /opt/selenium \
219+
&& curl http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip -o /opt/selenium/chromedriver_linux64.zip \
220+
&& cd /opt/selenium; unzip /opt/selenium/chromedriver_linux64.zip; rm -rf chromedriver_linux64.zip; ln -fs /opt/selenium/chromedriver /usr/local/bin/chromedriver;
221+
205222
CMD ["python3"]

0 commit comments

Comments
 (0)