Add Dockerfile and build script for multi-arch build
This commit is contained in:
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# Install jq, curl and ca-certificates
|
||||
RUN apk add --no-cache jq curl ca-certificates bash tar
|
||||
|
||||
# Create a directory for speedtest
|
||||
WORKDIR /app
|
||||
|
||||
# Download the appropriate speedtest binary based on architecture
|
||||
ARG TARGETARCH
|
||||
# Download the appropriate speedtest binary based on architecture
|
||||
RUN set -ex; \
|
||||
if [ "$TARGETARCH" = "amd64" ]; then \
|
||||
ARCH="x86_64"; \
|
||||
elif [ "$TARGETARCH" = "arm64" ]; then \
|
||||
ARCH="aarch64"; \
|
||||
elif [ "$TARGETARCH" = "arm" ]; then \
|
||||
ARCH="armhf"; \
|
||||
else \
|
||||
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
|
||||
fi; \
|
||||
URL="https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-${ARCH}.tgz"; \
|
||||
echo "Downloading speedtest from: $URL"; \
|
||||
curl -sSLo speedtest.tgz "$URL"; \
|
||||
tar zxvf speedtest.tgz speedtest; \
|
||||
rm speedtest.tgz; \
|
||||
mv speedtest /usr/local/bin/; \
|
||||
chmod +x /usr/local/bin/speedtest
|
||||
|
||||
# Copy the script
|
||||
COPY send-speedtest.sh /usr/local/bin/send-speedtest.sh
|
||||
RUN chmod +x /usr/local/bin/send-speedtest.sh
|
||||
|
||||
# Run the script by default
|
||||
ENTRYPOINT ["/usr/local/bin/send-speedtest.sh"]
|
||||
Reference in New Issue
Block a user