Dockerfile for speedtest-go (#3)
* fix a typo in the Readme an built a Dockerfile * typo on the RUN
This commit is contained in:
parent
64cf616e59
commit
a992da4780
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -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"]
|
@ -49,14 +49,12 @@ manually, you can install newer version of Go into your GOPATH:
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ git clone github.com/librespeed/speedtest-go
|
$ git clone github.com/librespeed/speedtest-go
|
||||||
# Switch to the Go branch
|
|
||||||
$ git checkout go
|
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Build
|
2. Build
|
||||||
```
|
```
|
||||||
# Change current working directory to the repository
|
# Change current working directory to the repository
|
||||||
$ cd speedtest
|
$ cd speedtest-go
|
||||||
# Compile
|
# Compile
|
||||||
$ go build -ldflags "-w -s" -trimpath -o speedtest main.go
|
$ go build -ldflags "-w -s" -trimpath -o speedtest main.go
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user