暫無描述

Dockerfile 799B

1234567891011121314151617181920212223242526272829303132333435363738
  1. FROM golang:1.14.4 as backend
  2. COPY . /app
  3. WORKDIR /app
  4. ENV GOOS=linux \
  5. GOARCH=amd64 \
  6. GOPROXY=https://goproxy.cn,direct \
  7. GO111MODULE=on
  8. RUN go build -o webpprof github.com/google/pprof/cmd/webpprof \
  9. && ls
  10. FROM node:latest as frontend
  11. # 添加taobao镜像源并安装vue-cli 3.0
  12. RUN npm config set registry http://registry.npm.taobao.org \
  13. && npm install -g @vue/cli
  14. COPY web /web
  15. WORKDIR /web
  16. # 安装依赖并构建
  17. RUN npm install && npm run build
  18. # 这里一定要使用带glibc的apline,不然会报standard_init_linux.go:207: exec user process caused "no such file or directory" 错误
  19. FROM frolvlad/alpine-glibc:latest
  20. COPY --from=backend /app/webpprof /app/webpprof
  21. COPY --from=frontend /web/dist/ /app/html/
  22. EXPOSE 8090
  23. ENTRYPOINT ["/app/webpprof"]