forked from MiguelNdeCarvalho/speedtest-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
31 lines (23 loc) · 902 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM python:3.11.0-alpine3.15
# Speedtest CLI Version
ARG SPEEDTEST_VERSION=1.2.0
# Create user
RUN adduser -D speedtest
WORKDIR /app
COPY src/requirements.txt .
# Install required modules and Speedtest CLI
RUN pip install --no-cache-dir -r requirements.txt && \
ARCHITECTURE=$(uname -m) && \
export ARCHITECTURE && \
if [ "$ARCHITECTURE" = 'armv7l' ];then ARCHITECTURE="armhf";fi && \
wget -nv -O /tmp/speedtest.tgz "https://install.speedtest.net/app/cli/ookla-speedtest-${SPEEDTEST_VERSION}-linux-${ARCHITECTURE}.tgz" && \
tar zxvf /tmp/speedtest.tgz -C /tmp && \
cp /tmp/speedtest /usr/local/bin && \
chown -R speedtest:speedtest /app && \
rm -rf \
/tmp/* \
/app/requirements
COPY src/. .
USER speedtest
CMD ["python", "-u", "exporter.py"]
HEALTHCHECK --timeout=10s CMD wget --no-verbose --tries=1 --spider http://localhost:${SPEEDTEST_PORT:=9798}/