|
@@ -1,19 +1,63 @@
|
|
|
-#不需要goalng环境 小版本 环境
|
|
|
-# FROM alpine:3.13
|
|
|
+FROM golang:1.15-alpine AS builder
|
|
|
+
|
|
|
+RUN go env -w GO111MODULE=on
|
|
|
+RUN go env -w GOPROXY=https://goproxy.cn,direct
|
|
|
+
|
|
|
+COPY . /go/src/construction_management
|
|
|
+# 编译
|
|
|
+WORKDIR /go/src/construction_management/web
|
|
|
+#install 执行文件会生成在 gopath/bin 中
|
|
|
+RUN go install ./
|
|
|
+
|
|
|
+FROM alpine:3.13
|
|
|
+# 把编译环境中编译好的 chat 复制到生产镜像中的 bin/chat 文件名称 不是目录
|
|
|
+#COPY --from=builder /go/bin/chat /bin/chat
|
|
|
+# /chat 放到根目录
|
|
|
+COPY --from=builder /go/bin/construction_management /construction_management
|
|
|
+COPY --from=builder /go/src/construction_management/config-debug.yaml /config-debug.yaml
|
|
|
+COPY --from=builder /go/src/construction_management/config-uat.yaml /config-uat.yaml
|
|
|
+COPY --from=builder /go/src/construction_management/config-pro.yaml /config-pro.yaml
|
|
|
+RUN mkdir -p /lib
|
|
|
+COPY --from=builder /go/src/construction_management/lib/*.json /lib/
|
|
|
+
|
|
|
+RUN chmod 777 /construction_management/lib/*.json
|
|
|
+RUN chmod 777 /construction_management
|
|
|
+RUN chmod 777 /config-debug.yaml
|
|
|
+RUN chmod 777 /config-uat.yaml
|
|
|
+RUN chmod 777 /config-pro.yaml
|
|
|
|
|
|
-# MAINTAINER cp cpthought@vip.qq.com
|
|
|
+ENV ADDR=:6060
|
|
|
|
|
|
-FROM centos:7
|
|
|
+# 申明暴露的端口
|
|
|
+EXPOSE 6060
|
|
|
|
|
|
+# 设置服务入口
|
|
|
+ENTRYPOINT ["sh","-c", "/construction_management" ]
|
|
|
|
|
|
-# ADD /bin/construction_management /
|
|
|
-ADD /bin/ /
|
|
|
-RUN chmod 777 /construction_management
|
|
|
-ENV PARAMS=""
|
|
|
|
|
|
-EXPOSE 6060
|
|
|
|
|
|
-#ENV Debug=true
|
|
|
|
|
|
-ENTRYPOINT ["sh","-c","/construction_management $PARAMS"]
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# FROM centos:7
|
|
|
+
|
|
|
+# ADD /bin/ /
|
|
|
+# RUN chmod 777 /construction_management
|
|
|
+# ENV PARAMS=""
|
|
|
+
|
|
|
+# EXPOSE 6060
|
|
|
+
|
|
|
+# ENTRYPOINT ["sh","-c","/construction_management $PARAMS"]
|