Skip to content

Commit

Permalink
Fixed WebDriverException on armv7l #8
Browse files Browse the repository at this point in the history
Rebuild Dockerfile
Added Rust Installtion
Updated Geckodriver
Update libc6
Take screenshot if measurement fails
  • Loading branch information
Your Name committed Aug 12, 2022
1 parent d3a2f60 commit e12202c
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 23 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
ile: Dockerfile.debian
file: Dockerfile
tags: |
shneezin/breitbandmessung-node:dev
shneezin/breitbandmessung:dev
platforms: linux/amd64
build-args: |
COMMIT_SHA=${{ github.sha }}
Expand All @@ -76,9 +76,9 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
ile: Dockerfile.debian
file: Dockerfile
tags: |
shneezin/breitbandmessung-node:test
shneezin/breitbandmessung:test
platforms: linux/amd64, linux/arm64/v8, linux/arm/v7
build-args: |
COMMIT_SHA=${{ github.sha }}
Expand Down
77 changes: 61 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,72 @@
FROM python:slim-bullseye

RUN apt-get update \
&& apt-get install --no-install-recommends -y firefox-esr tini cron curl build-essential libssl-dev libffi-dev python3-dev cargo \
&& rm -rf /var/lib/apt/lists/*
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.62.1

RUN pip3 install --no-cache-dir \
selenium \
apprise \
psutil \
influxdb

WORKDIR /usr/src/app

COPY speedtest.py config.shlib geckodriver.sh config.cfg.defaults ./

COPY entrypoint.sh /usr/local/bin/docker-entrypoint.sh

RUN chmod +x ./geckodriver.sh && ./geckodriver.sh
RUN set -eux; \
apt-get update; \
apt-get install --no-install-recommends -y firefox-esr \
tini \
cron \
gcc \
ca-certificates \
wget \
build-essential \
libssl-dev \
libffi-dev \
python3-dev \
cargo \
curl \
; \
chmod +x /usr/src/app/geckodriver.sh;\
/bin/bash /usr/src/app/geckodriver.sh; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='3dc5ef50861ee18657f9db2eeb7392f9c2a6c95c90ab41e45ab4ca71476b4338' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='67777ac3bc17277102f2ed73fd5f14c51f4ca5963adadf7f174adf4ebc38747b' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='32a1532f7cef072a667bac53f1a5542c99666c4071af0c9549795bbdb2069ec1' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e50d1deb99048bc5782a0200aa33e4eea70747d49dffdc9d06812fd22a372515' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.24.3/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup update; \
rustup --version; \
cargo --version; \
rustc --version; \
printf "deb http://ftp.debian.org/debian experimental main\ndeb http://ftp.debian.org/debian sid main" > /etc/apt/sources.list.d/experimental.list; \
apt-get update ;\
apt-get install --no-install-recommends -t experimental -y libc6-dev; \
apt-get remove -y --auto-remove \
wget \
curl \
; \
rm -rf /var/lib/apt/lists/*; \
pip3 install --upgrade pip; \
pip3 install --no-cache-dir --upgrade setuptools; \
chmod +x /usr/src/app/speedtest.py; \
mkdir /export; \
chmod +x /usr/local/bin/docker-entrypoint.sh;

RUN chmod +x speedtest.py
RUN --mount=type=tmpfs,target=/usr/local/cargo pip3 install --no-cache-dir \
cryptography; \
pip3 install --no-cache-dir \
selenium \
apprise \
psutil \
influxdb;

RUN mkdir /export

RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["tini", "--", "docker-entrypoint.sh"]
ENTRYPOINT ["tini", "--", "docker-entrypoint.sh"]
Binary file added geckodriver-v0.31.0-linux-aarch64 .tar.gz
Binary file not shown.
Binary file added geckodriver-v0.31.0-linuxarm32.tar.gz
Binary file not shown.
7 changes: 5 additions & 2 deletions geckodriver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ if [ $os = "Linux" ] ; then
url=https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
;;
xscale | arm | armv61 | armv71 | armv81 | aarch64 | armv7l )
url=https://github.com/shneezin/breitbandmessung/raw/main/geckodriver-v0.30.0-linuxarm32.tar.gz
url=https://github.com/shneezin/breitbandmessung/raw/main/geckodriver-v0.31.0-linuxarm32.tar.gz
;;
aarch64)
url=https://github.com/shneezin/breitbandmessung/raw/main/geckodriver-v0.31.0-linux-aarch64.tar.gz
;;
*)
echo Architecture not supported: $arch
Expand All @@ -31,4 +34,4 @@ echo $arch

curl -s -L "$url" | tar -xz
chmod +x geckodriver
mv geckodriver /usr/bin
mv geckodriver /usr/bin
15 changes: 14 additions & 1 deletion speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,19 @@
db_client.write_points(json_body)
db_client.close()
break
except:
now = datetime.now()
current_time = now.strftime("%H_%M_%S")
current_date = now.strftime("%d_%m_%Y")
filename = (
DOWNLOADED_PATH
+ SCREENSHOTNAME
+ current_date
+ "_error_"
+ current_time
+ SCREENSHOTTEXT
)
browser.save_screenshot(filename)
finally:
time.sleep(SLEEPTIME)

Expand Down Expand Up @@ -247,4 +260,4 @@
)

browser.close()
exit()
exit()

0 comments on commit e12202c

Please sign in to comment.