Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #前端预构建
  2. # FROM cmfont-cache:latest as builderFont
  3. # COPY /client .
  4. # RUN cnpm run build
  5. # 后端预构建
  6. #FROM cm-gocache:latest AS builder
  7. # FROM golang:1.15-alpine AS builder
  8. # RUN go env -w GO111MODULE=on
  9. # RUN go env -w GOPROXY=https://goproxy.cn,direct
  10. # COPY . /go/src/construction_management
  11. # # 编译
  12. # WORKDIR /go/src/construction_management/web
  13. # RUN ls ./
  14. # #install 执行文件会生成在 gopath/bin 中
  15. # RUN go mod tidy
  16. # RUN go install ./
  17. # # 正式镜像
  18. # FROM alpine:3.13
  19. # # 安装nginx
  20. # RUN echo http://mirrors.aliyun.com/alpine/v3.10/main>/etc/apk/repositories && \
  21. # echo http://mirrors.aliyun.com/alpine/v3.10/community>>/etc/apk/repositories
  22. # RUN apk update && apk upgrade \
  23. # && apk add nginx \
  24. # && mkdir /run/nginx \
  25. # && touch /run/nginx.pid && \
  26. # # chmod 755 /run.sh && \
  27. # apk del m4 autoconf make gcc g++ linux-headers
  28. # RUN find / -name ngnix.pid
  29. # # 复制配置文件和前端文件
  30. # # COPY --from=builder /go/src/construction_management/deployment/default.conf /etc/nginx/conf.d
  31. # # COPY --from=builderFont /build /var/www/html/client
  32. # # 后端相关
  33. # # 把编译环境中编译好的 chat 复制到生产镜像中的 bin/chat 文件名称 不是目录
  34. # #COPY --from=builder /go/bin/chat /bin/chat
  35. # # /chat 放到根目录
  36. # COPY --from=builder /go/bin/web /bin/server
  37. # COPY --from=builder /go/src/construction_management/server/web/config-debug.yaml /bin/config-debug.yaml
  38. # COPY --from=builder /go/src/construction_management/server/web/config-uat.yaml /bin/config-uat.yaml
  39. # COPY --from=builder /go/src/construction_management/server/web/config-pro.yaml /bin/config-pro.yaml
  40. # RUN mkdir -p /lib
  41. # COPY --from=builder /go/src/construction_management/server/lib/*.json /bin/lib/
  42. # RUN chmod 777 /bin/lib/*.json
  43. # RUN chmod 777 /bin/server
  44. # RUN chmod 777 /bin/config-debug.yaml
  45. # RUN chmod 777 /bin/config-uat.yaml
  46. # RUN chmod 777 /bin/config-pro.yaml
  47. # ENV ADDR=:6060
  48. # # 申明暴露的端口
  49. # EXPOSE 80
  50. # EXPOSE 6060
  51. # # 设置服务入口
  52. # # ENTRYPOINT ["/run.sh"]
  53. # 要放到bin 目录下才能运行 在 alpine 环境中
  54. # ENTRYPOINT ["sh","-c", "/bin/server" ]
  55. FROM centos:7
  56. # FROM alpine:3.13
  57. # 要运行 centos中,可以放在随意的目录中运行
  58. # COPY ./bin/construction_management /
  59. ADD /bin/ /
  60. RUN chmod 777 /construction_management
  61. RUN ls
  62. ENV PARAMS=""
  63. EXPOSE 6060
  64. ENTRYPOINT ["sh","-c","/construction_management $PARAMS"]