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.
This commit is contained in:
Marty Oehme 2021-05-19 15:37:30 +02:00
parent c214c9aed0
commit 0d868c05fe
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 17 additions and 12 deletions

View file

@ -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 && \
\

View file

@ -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 "$@"