github.com/laof/lite-speed-test@v0.0.0-20230930011949-1f39b7037845/docker/Dockerfile (about)

     1  # sudo docker build   --network=host  -t lite:0.1 -f ./docker/Dockerfile ./
     2  FROM golang:1.19 as wasm
     3  ADD / /wasm/lite
     4  WORKDIR /wasm/lite
     5  RUN cp $(go env GOROOT)/misc/wasm/wasm_exec.js ./web/gui/wasm_exec.js
     6  
     7  FROM node:16 as gui
     8  ADD / /gui/lite
     9  WORKDIR /gui/lite
    10  COPY --from=wasm /wasm/lite/web/gui/wasm_exec.js /gui/lite/web/gui/wasm_exec.js 
    11  RUN npm install --prefix web/gui build
    12  RUN npm run --prefix web/gui build
    13  
    14  FROM golang:1.19 as build
    15  ADD / /go/lite
    16  WORKDIR /go/lite
    17  COPY  --from=gui /gui/lite/web/gui/dist/ /go/lite/web/gui/dist
    18  # china only
    19  # RUN go env -w GOPROXY=https://goproxy.cn,direct
    20  RUN go mod tidy
    21  RUN GOOS=js GOARCH=wasm go get -u ./...
    22  RUN GOOS=js GOARCH=wasm go build -o ./web/gui/dist/main.wasm ./wasm
    23  RUN make dockerbin
    24  
    25  FROM gcr.io/distroless/static-debian11
    26  # FROM gcr.lank8s.cn/distroless/static-debian11
    27  COPY --from=build /go/lite/bin/lite-dockerbin /
    28  EXPOSE 10888
    29  CMD [ "/lite-dockerbin" ]