You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

  1. FROM node:12.16.1 as gva-web
  2. WORKDIR /gva_web/
  3. COPY web/ .
  4. RUN cat .env.production
  5. COPY docker/web-handle.sh .
  6. RUN sh ./web-handle.sh
  7. RUN cat .env.production
  8. RUN rm -f web-handle.sh
  9. RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
  10. RUN cnpm install || npm install
  11. RUN npm run build
  12. FROM golang:alpine as gva-server
  13. ENV GO111MODULE=on
  14. ENV GOPROXY=https://goproxy.io,direct
  15. WORKDIR /go/src/gin-vue-admin
  16. COPY server/ ./
  17. RUN cat ./core/server.go
  18. RUN cat ./config.yaml
  19. COPY docker/server-handle.sh .
  20. RUN sh ./server-handle.sh
  21. RUN rm -f server-handle.sh
  22. RUN cat ./core/server.go
  23. RUN cat ./config.yaml
  24. RUN go env && go list && go build -o gva-server .
  25. FROM nginx:alpine
  26. LABEL MAINTAINER="SliverHorn"
  27. WORKDIR gva/
  28. # copy web
  29. COPY --from=gva-web /gva_web/dist ./resource/dist
  30. # copy server
  31. COPY --from=gva-server /go/src/gin-vue-admin/gva-server ./
  32. COPY --from=gva-server /go/src/gin-vue-admin/config.yaml ./
  33. COPY --from=gva-server /go/src/gin-vue-admin/resource ./resource
  34. EXPOSE 8888
  35. ENTRYPOINT ./gva-server
  36. # 根据Dockerfile生成Docker镜像
  37. # docker build -t gva-server:1.0 .
  38. #- 根据Docker镜像启动Docker容器
  39. # - 后台运行
  40. # - ```
  41. # docker run -d -p 8888:8888 --name gva-server-v1 gva-server:1.0
  42. # ```
  43. # - 以可交互模式运行, Ctrl + p + q
  44. # - ```
  45. # docker run -it -p 8888:8888 --name gva-server-v1 gva-server:1.0
  46. # ```