Sign inSign up

stanhu86/speedtest

By stanhu86

•Updated about 1 year ago

librespeed/speedtest-go based on Alpine docker image

Image
Networking
Web servers
0

265

stanhu86/speedtest repository overview

⁠Usage

speedtest:
  image: stanhu86/speedtest:latest
  container_name: speedtest
  restart: unless-stopped
  user: "${UID_GID}"
  ports:
    - "127.0.0.1:8989:8989"
  volumes:
    - ./speedtest/settings.toml:/app/settings.toml
  environment:
    - TZ=CST

⁠GitHub

https://github.com/stanhu86/speedtest-go⁠

git clone https://github.com/stanhu86/speedtest-go
cd speedtest-go

⁠settings.toml

# bind address, use empty string to bind to all interfaces
bind_address=""
# backend listen port
listen_port=8989
# change the base URL
# url_base="/librespeed"
# proxy protocol port, use 0 to disable
proxyprotocol_port=0
# Server location
server_lat=1
server_lng=1
# ipinfo.io API key, if applicable
ipinfo_api_key=""

# assets directory path, defaults to `assets` in the same directory
assets_path="assets"

# password for logging into statistics page
statistics_password="PASSWORD"
# redact IP addresses
redact_ip_addresses=false

# database type for statistics data, currently supports: none, memory, bolt, mysql, postgresql
# if none is specified, no telemetry/stats will be recorded, and no result PNG will be generated
database_type="memory"
database_hostname=""
database_name=""
database_username=""
database_password=""

# if you use `bolt` as database, set database_file to database file location
database_file="speedtest.db"

# TLS and HTTP/2 settings. TLS is required for HTTP/2
enable_tls=false
enable_http2=false

# if you use HTTP/2 or TLS, you need to prepare certificates and private keys
# tls_cert_file="cert.pem"
# tls_key_file="privkey.pem"

⁠Dockerfile

ARG ALPINE_VERSION=3.22
ARG GO_VERSION=1.25

FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
WORKDIR /build

COPY ./ ./
RUN go build -ldflags "-w -s" -trimpath -o speedtest .
RUN set -eux; \
    mv web/assets/example-singleServer-gauges.html web/assets/index.html; \
    sed -i 's/LibreSpeed Example/LibreSpeed SpeedTest/g' web/assets/index.html


FROM alpine:${ALPINE_VERSION}
WORKDIR /app

ENV TZ="UTC"
RUN set -eux; \
    apk add --update --no-cache ca-certificates; \
    apk del openssl apk-tools

COPY --from=builder /build/web/assets/index.html /build/web/assets/*.js /app/assets/
COPY --from=builder /build/speedtest /build/settings.toml /app/

CMD [ "/app/speedtest" ]

Tag summary

Content type

Image

Digest

sha256:bd1e22e38…

Size

9.5 MB

Last updated

about 1 year ago

docker pull stanhu86/speedtest