From 0d868c05fe0369d0af953bac85559e4f9e94d430 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 19 May 2021 15:37:30 +0200 Subject: [PATCH] Move dependency installation to Dockerfile Moved installation of speedtest commandline utility to Dockerfile. Did not remove the (optional, if no cmdline utility found) installation from entrypoint, so that the program can be run from entrypoint without using docker as a fall-back. --- Dockerfile | 10 ++++++++-- entrypoint.sh | 19 +++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac39223..3c75e0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.8-slim-buster -LABEL maintainer="Breadlysm" \ - description="Original by Aiden Gilmartin. Maintained by Breadlysm" +LABEL maintainer="Marty Oehme" \ + description="Original by Aiden Gilmartin & Breadlysm." ENV DEBIAN_FRONTEND=noninteractive @@ -10,6 +10,12 @@ RUN true &&\ apt-get update && \ apt-get -q -y install --no-install-recommends apt-utils gnupg1 apt-transport-https dirmngr && \ \ +# Add repos +apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61 && \ +echo "deb https://ookla.bintray.com/debian buster main" > /etc/apt/sources.list.d/speedtest.list && \ +apt-get update && \ +apt-get -q -y install --no-install-recommends speedtest && \ +\ # Install Python packages pip3 install pythonping influxdb-client && \ \ diff --git a/entrypoint.sh b/entrypoint.sh index 9198112..8c1282a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,16 +1,15 @@ #!/bin/sh -printenv >> /etc/environment -ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +printenv >>/etc/environment +ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" >/etc/timezone # Install speedtest-cli -if [ ! -e /usr/bin/speedtest ] -then - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61 - echo "deb https://ookla.bintray.com/debian buster main" | tee /etc/apt/sources.list.d/speedtest.list - apt-get update && apt-get -q -y install speedtest - apt-get -q -y autoremove && apt-get -q -y clean - rm -rf /var/lib/apt/lists/* +if [ ! -e /usr/bin/speedtest ]; then + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61 + echo "deb https://ookla.bintray.com/debian buster main" | tee /etc/apt/sources.list.d/speedtest.list + apt-get update && apt-get -q -y install speedtest + apt-get -q -y autoremove && apt-get -q -y clean + rm -rf /var/lib/apt/lists/* fi -exec /usr/local/bin/python3 $@ +exec /usr/local/bin/python3 "$@"