Dockerfile 477 B

123456789101112131415161718192021
  1. FROM golang:1.16 as builder
  2. # Setting environment variables
  3. ENV GOPROXY="https://goproxy.cn,direct" \
  4. GO111MODULE="on" \
  5. CGO_ENABLED="0" \
  6. GOOS="linux" \
  7. GOARCH="amd64"
  8. # Switch to workspace
  9. WORKDIR /go/src/github.com/gowebspider/jsrpc/
  10. # Load file
  11. COPY . .
  12. # add rely
  13. # Build and place the results in /tmp/jsrpc
  14. RUN go mod tidy && go build -o /tmp/jsrpc .
  15. FROM alpine:latest
  16. WORKDIR /root/
  17. COPY --from=builder /tmp/jsrpc .
  18. EXPOSE 12080 12443
  19. CMD ["./jsrpc"]