From daacac44fb070308be6f80e79a68839af6915a3a Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Tue, 30 Jun 2020 10:06:59 +0800 Subject: [PATCH 1/2] fix a typo in the Readme an built a Dockerfile --- Dockerfile | 20 ++++++++++++++++++++ README.md | 4 +--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e9f8182 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FFROM golang:alpine AS build_base +#ENV GOARCH arm64 +#ENV GOARCH amd64 +RUN apk add --no-cache git gcc ca-certificates libc-dev \ +&& mkdir -p /go/src/github.com/librespeed/ \ +&& cd /go/src/github.com/librespeed/ \ +&& git clone https://github.com/librespeed/speedtest-go.git +WORKDIR /go/src/github.com/librespeed/speedtest-go +RUN go get ./ && go build -ldflags "-w -s" -trimpath -o speedtest main.go + +FROM alpine:3.9 +RUN apk add ca-certificates +WORKDIR /app +COPY --from=build_base /go/src/github.com/librespeed/speedtest-go/speedtest . +COPY --from=build_base /go/src/github.com/librespeed/speedtest-go/assets ./assets +COPY --from=build_base /go/src/github.com/librespeed/speedtest-go/settings.toml . + +EXPOSE 8989 + +CMD ["speedtest"] \ No newline at end of file diff --git a/README.md b/README.md index 9851e2c..2b8507b 100644 --- a/README.md +++ b/README.md @@ -49,14 +49,12 @@ manually, you can install newer version of Go into your GOPATH: ``` $ git clone github.com/librespeed/speedtest-go - # Switch to the Go branch - $ git checkout go ``` 2. Build ``` # Change current working directory to the repository - $ cd speedtest + $ cd speedtest-go # Compile $ go build -ldflags "-w -s" -trimpath -o speedtest main.go ``` From 7d16494949da21a91aa19bfc4eb289d4fe9bd61e Mon Sep 17 00:00:00 2001 From: mickkael <19755421+mickkael@users.noreply.github.com> Date: Tue, 30 Jun 2020 10:12:00 +0800 Subject: [PATCH 2/2] typo on the RUN --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e9f8182..c4b18a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,4 @@ COPY --from=build_base /go/src/github.com/librespeed/speedtest-go/settings.toml EXPOSE 8989 -CMD ["speedtest"] \ No newline at end of file +CMD ["./speedtest"] \ No newline at end of file