diff --git a/README.md b/README.md index 8228c50..816c1cf 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,26 @@ $ makepkg -si See the [librespeed-cli Homebrew tap](https://github.com/librespeed/homebrew-tap#setup). +## Container Image + +You can run `librespeed-cli` in a container. + +1. Build the container image: + + ```shell script + docker build -t librespeed-cli:latest . + ``` + +2. Run the container: + + ```shell script + docker run --rm --name librespeed-cli librespeed-cli:latest + # With options + docker run --rm --name librespeed-cli librespeed-cli:latest --telemetry-level disabled --no-upload + # To avoid "Failed to ping target host: socket: permission denied" errors when using --verbose + docker run --rm --name librespeed-cli --sysctl net.ipv4.ping_group_range="0 2147483647" librespeed-cli:latest --verbose + ``` + ## Usage You can see the full list of supported options with `librespeed-cli -h`: diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..11ae38d --- /dev/null +++ b/dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.17.7-buster as builder + +# Set working directory +WORKDIR /usr/src/librespeed-cli + +# Copy librespeed-cli +COPY . . + +# Build librespeed-cli +RUN ./build.sh + +FROM golang:1.17.7-buster + +# Copy librespeed-cli binary +COPY --from=builder /usr/src/librespeed-cli/out/librespeed-cli* /usr/src/librespeed-cli/librespeed-cli + +ENTRYPOINT ["/usr/src/librespeed-cli/librespeed-cli"]