librespeed/Dockerfile

42 lines
966 B
Text
Raw Permalink Normal View History

2020-07-16 22:58:22 +00:00
FROM golang:alpine as builder
ENV GCO_ENABLED=0
ARG VERSION=v1.1.0
2020-07-16 22:58:22 +00:00
RUN set -ex \
&& apk add \
curl \
git \
&& git clone -b "${VERSION}" --depth=1 "https://github.com/librespeed/speedtest-go.git" /src \
2020-07-16 22:58:22 +00:00
&& cd /src \
&& go build \
-o speedtest \
-mod=readonly \
&& curl -sSfLo dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64" \
&& install -D -m755 -t /build/usr/local/bin \
dumb-init \
speedtest \
&& install -D -t /build/usr/local/share/speedtest/ \
assets/* \
&& mkdir -p /build/etc/speedtest \
&& touch /build/etc/speedtest/.keep
FROM alpine
RUN set -ex \
&& apk --no-cache add \
bash \
coreutils
COPY --from=builder /build/ /
COPY docker-entrypoint.sh /usr/local/bin/
EXPOSE 8989
VOLUME ["/data"]
WORKDIR /etc/speedtest
ENTRYPOINT ["/usr/local/bin/dumb-init"]
CMD ["/bin/bash", "/usr/local/bin/docker-entrypoint.sh"]