caipin 2 éve
szülő
commit
5f62ca92eb
1 módosított fájl, 65 hozzáadás és 64 törlés
  1. 65 64
      deployment/Dockerfile

+ 65 - 64
deployment/Dockerfile

@@ -6,66 +6,66 @@
 
 # 后端预构建
 #FROM cm-gocache:latest AS builder
-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
-
-RUN ls ./
-#install 执行文件会生成在 gopath/bin 中
-RUN go mod tidy
-RUN go install ./
-
-
-
-
-# 正式镜像
-FROM alpine:3.13
-
-# 安装nginx
-RUN echo http://mirrors.aliyun.com/alpine/v3.10/main>/etc/apk/repositories && \
-    echo  http://mirrors.aliyun.com/alpine/v3.10/community>>/etc/apk/repositories
-RUN apk update && apk upgrade \
-    && apk add nginx \
-    && mkdir /run/nginx  \
-    && touch /run/nginx.pid && \
-    # chmod 755 /run.sh && \
-    apk del m4 autoconf make gcc g++ linux-headers
-
-RUN find / -name ngnix.pid
-
-# 复制配置文件和前端文件
-# COPY --from=builder /go/src/construction_management/deployment/default.conf /etc/nginx/conf.d
-# COPY --from=builderFont /build /var/www/html/client
-
-# 后端相关
-# 把编译环境中编译好的 chat 复制到生产镜像中的  bin/chat 文件名称 不是目录
-#COPY --from=builder /go/bin/chat /bin/chat
-# /chat 放到根目录
-COPY --from=builder /go/bin/web /server
-COPY --from=builder /go/src/construction_management/server/web/config-debug.yaml /config-debug.yaml
-COPY --from=builder /go/src/construction_management/server/web/config-uat.yaml /config-uat.yaml
-COPY --from=builder /go/src/construction_management/server/web/config-pro.yaml /config-pro.yaml
-RUN mkdir -p /lib
-COPY --from=builder /go/src/construction_management/server/lib/*.json /lib/
-
-RUN chmod 777 /lib/*.json
-RUN chmod 777 /server
-RUN chmod 777 /config-debug.yaml
-RUN chmod 777 /config-uat.yaml
-RUN chmod 777 /config-pro.yaml
-
-ENV ADDR=:6060
-
-# 申明暴露的端口
-EXPOSE 80
-EXPOSE 6060
+# 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
+
+# RUN ls ./
+# #install 执行文件会生成在 gopath/bin 中
+# RUN go mod tidy
+# RUN go install ./
+
+
+
+
+# # 正式镜像
+# FROM alpine:3.13
+
+# # 安装nginx
+# RUN echo http://mirrors.aliyun.com/alpine/v3.10/main>/etc/apk/repositories && \
+#     echo  http://mirrors.aliyun.com/alpine/v3.10/community>>/etc/apk/repositories
+# RUN apk update && apk upgrade \
+#     && apk add nginx \
+#     && mkdir /run/nginx  \
+#     && touch /run/nginx.pid && \
+#     # chmod 755 /run.sh && \
+#     apk del m4 autoconf make gcc g++ linux-headers
+
+# RUN find / -name ngnix.pid
+
+# # 复制配置文件和前端文件
+# # COPY --from=builder /go/src/construction_management/deployment/default.conf /etc/nginx/conf.d
+# # COPY --from=builderFont /build /var/www/html/client
+
+# # 后端相关
+# # 把编译环境中编译好的 chat 复制到生产镜像中的  bin/chat 文件名称 不是目录
+# #COPY --from=builder /go/bin/chat /bin/chat
+# # /chat 放到根目录
+# COPY --from=builder /go/bin/web /server
+# COPY --from=builder /go/src/construction_management/server/web/config-debug.yaml /config-debug.yaml
+# COPY --from=builder /go/src/construction_management/server/web/config-uat.yaml /config-uat.yaml
+# COPY --from=builder /go/src/construction_management/server/web/config-pro.yaml /config-pro.yaml
+# RUN mkdir -p /lib
+# COPY --from=builder /go/src/construction_management/server/lib/*.json /lib/
+
+# RUN chmod 777 /lib/*.json
+# RUN chmod 777 /server
+# RUN chmod 777 /config-debug.yaml
+# RUN chmod 777 /config-uat.yaml
+# RUN chmod 777 /config-pro.yaml
+
+# ENV ADDR=:6060
+
+# # 申明暴露的端口
+# EXPOSE 80
+# EXPOSE 6060
 
-# 设置服务入口
-# ENTRYPOINT ["/run.sh"]
-ENTRYPOINT ["sh","-c", "/server" ]
+# # 设置服务入口
+# # ENTRYPOINT ["/run.sh"]
+# ENTRYPOINT ["sh","-c", "/server" ]
 
 
 
@@ -86,11 +86,12 @@ ENTRYPOINT ["sh","-c", "/server" ]
 
 
 # FROM centos:7
+FROM alpine:3.13
 
-# ADD /bin/ /
-# RUN chmod 777 /construction_management
-# ENV PARAMS=""
+ADD /bin/ /
+RUN chmod 777 /construction_management
+ENV PARAMS=""
 
-# EXPOSE 6060
+EXPOSE 6060
 
-# ENTRYPOINT ["sh","-c","/construction_management $PARAMS"]
+ENTRYPOINT ["sh","-c","/construction_management $PARAMS"]