Skip to content

Commit

Permalink
fix: remove chromedriver install (#3744)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpcross authored Apr 19, 2024
1 parent f7e9ada commit 02177d3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
6 changes: 5 additions & 1 deletion docker/app.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM ghcr.io/ietf-tools/mailarchive-app-base:latest
FROM --platform=linux/amd64 ghcr.io/ietf-tools/mailarchive-app-base:latest
LABEL maintainer="IETF Tools Team <[email protected]>"

ENV DEBIAN_FRONTEND=noninteractive

# "fake" dbus address to prevent errors
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

# Copy library scripts to execute
ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.236.0/containers/python-3/.devcontainer/library-scripts/common-debian.sh /tmp/library-scripts/
ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.236.0/containers/python-3/.devcontainer/library-scripts/python-debian.sh /tmp/library-scripts/
Expand Down
10 changes: 0 additions & 10 deletions docker/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,13 @@ RUN apt-get update --fix-missing && apt-get install -qy \
wget \
zsh

# Install chromedriver
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
chmod +x /tmp/app-install-chromedriver.sh
RUN /tmp/app-install-chromedriver.sh

# purge because of vulnerability (see https://www.cvedetails.com/)
RUN apt-get purge -y imagemagick imagemagick-6-common

# Get rid of installation files we don't need in the image, to reduce size
# this should be included in install layer above if chromedriver layer removed
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# "fake" dbus address to prevent errors
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

# Set locale to en_US.UTF-8
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
Expand Down
26 changes: 14 additions & 12 deletions docker/scripts/app-install-chromedriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

HOSTARCH=$(arch)
if [ $HOSTARCH == "x86_64" ]; then
echo "Installing chrome driver..."
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
apt-get update -y
apt-get install -y google-chrome-stable
CHROMEVER=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*")
DRIVERVER=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER")
wget -q --continue -P /chromedriver "http://chromedriver.storage.googleapis.com/$DRIVERVER/chromedriver_linux64.zip"
unzip /chromedriver/chromedriver* -d /chromedriver
ln -s /chromedriver/chromedriver /usr/local/bin/chromedriver
ln -s /chromedriver/chromedriver /usr/bin/chromedriver
DRIVERPATH=linux64/chromedriver-linux64.zip
DRIVERSUBDIR=chromedriver-linux64
elif [ $HOSTARCH == "arm64" ] || [ $HOSTARCH == "aarch64" ]; then
DRIVERPATH=mac-arm64/chromedriver-mac-arm64.zip
DRIVERSUBDIR=chromedriver-mac-arm64
else
echo $HOSTARCH
echo "This architecture doesn't support chromedriver. Skipping installation..."
fi
exit 1
fi

echo "Installing chrome driver..."
wget -q --continue -P /chromedriver "https://storage.googleapis.com/chrome-for-testing-public/$CHROMEDRIVER_VERSION/$DRIVERPATH"
unzip /chromedriver/chromedriver* -d /chromedriver
ln -s /chromedriver/$DRIVERSUBDIR/chromedriver /usr/local/bin/chromedriver
ln -s /chromedriver/$DRIVERSUBDIR/chromedriver /usr/bin/chromedriver

0 comments on commit 02177d3

Please sign in to comment.