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