瀏覽代碼

feature: add dockerfile

chenqinghe 4 年之前
父節點
當前提交
4bcddedc36
共有 1 個文件被更改,包括 35 次插入0 次删除
  1. 35
    0
      Dockerfile

+ 35
- 0
Dockerfile 查看文件

@@ -0,0 +1,35 @@
1
+FROM golang:1.14.4 as backend
2
+
3
+COPY . /app
4
+
5
+WORKDIR /app
6
+
7
+RUN GOOS=linux GOARCH=amd64 go build cmd/webpprof -o webpprof
8
+
9
+
10
+FROM node:latest as frontend
11
+
12
+# 添加taobao镜像源并安装vue-cli 3.0
13
+RUN npm config set registry https://registry.npmjs.org \
14
+    && npm install -g @vue/cli
15
+
16
+COPY web /web
17
+
18
+WORKDIR /web
19
+
20
+# 安装依赖并构建
21
+RUN npm install && npm run build
22
+
23
+
24
+FROM alpine:latest
25
+
26
+COPY --from=backend /app/webpprof /app/webpprof
27
+
28
+COPY --from=frontend /web/dist/   /app/html/
29
+
30
+EXPOSE 80
31
+
32
+ENTRYPOINT ["/app/webpprof"]
33
+
34
+
35
+