Skip to content

Commit 47aadd0

Browse files
committed
Merged in [19761] from nick@staff.ietf.org:
fix: skip chromedriver install if arch is not supported in docker build - Legacy-Id: 19764 Note: SVN reference [19761] has been migrated to Git commit 516877d
2 parents 5883e10 + 516877d commit 47aadd0

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

docker/app.Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,11 @@ RUN apt-get install -qy \
6565
yang-tools \
6666
zsh
6767

68-
# Install chromedriver
69-
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
70-
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
71-
apt-get update -y && \
72-
apt-get install -y google-chrome-stable && \
73-
CHROMEVER=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*") && \
74-
DRIVERVER=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER") && \
75-
wget -q --continue -P /chromedriver "http://chromedriver.storage.googleapis.com/$DRIVERVER/chromedriver_linux64.zip" && \
76-
unzip /chromedriver/chromedriver* -d /chromedriver && \
77-
ln -s /chromedriver/chromedriver /usr/local/bin/chromedriver && \
78-
ln -s /chromedriver/chromedriver /usr/bin/chromedriver
68+
# Install chromedriver if supported
69+
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
70+
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
71+
chmod +x /tmp/app-install-chromedriver.sh
72+
RUN /tmp/app-install-chromedriver.sh
7973

8074
# Get rid of installation files we don't need in the image, to reduce size
8175
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

docker/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ services:
3939
# (Adding the "ports" property to this file will not forward from a Codespace.)
4040

4141
db:
42+
# image: ghcr.io/ngpixel/datatracker-db:nightly-20211208
4243
build:
4344
context: ..
4445
dockerfile: docker/db.Dockerfile
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
HOSTARCH=$(arch)
4+
if [ $HOSTARCH == "x86_64" ]; then
5+
echo "Installing chrome driver..."
6+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
7+
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
8+
apt-get update -y
9+
apt-get install -y google-chrome-stable
10+
CHROMEVER=$(google-chrome --product-version | grep -o "[^\.]*\.[^\.]*\.[^\.]*")
11+
DRIVERVER=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEVER")
12+
wget -q --continue -P /chromedriver "http://chromedriver.storage.googleapis.com/$DRIVERVER/chromedriver_linux64.zip"
13+
unzip /chromedriver/chromedriver* -d /chromedriver
14+
ln -s /chromedriver/chromedriver /usr/local/bin/chromedriver
15+
ln -s /chromedriver/chromedriver /usr/bin/chromedriver
16+
else
17+
echo "This architecture doesn't support chromedriver. Skipping installation..."
18+
fi

0 commit comments

Comments
 (0)