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.

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