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.

41 lines
1.2 KiB

  1. FROM golang:alpine as builder
  2. RUN apk add --update --no-cache yarn make g++
  3. RUN yarn global add cross-env node-sass
  4. ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \
  5. GO111MODULE=on \
  6. CGO_ENABLED=1
  7. WORKDIR /go/src/gin-vue-admin
  8. RUN go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct
  9. COPY server/ ./
  10. RUN go env && go list && go build -v -a -ldflags "-extldflags \"-static\" " -o gvadmin .
  11. WORKDIR /web
  12. COPY web/ ./
  13. RUN yarn install && yarn run build
  14. FROM nginx:alpine
  15. LABEL MAINTAINER="rikugun"
  16. RUN apk add --no-cache gettext tzdata && \
  17. cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
  18. echo "Asia/Shanghai" > /etc/timezone && \
  19. date && \
  20. apk del tzdata
  21. COPY docker/etc/nginx/nginx.conf.tpl /etc/nginx/nginx.conf.tpl
  22. WORKDIR /app
  23. #copy web
  24. COPY --from=builder /web/dist/ /var/www/
  25. #copy go app
  26. COPY --from=builder /go/src/gin-vue-admin/gvadmin ./
  27. COPY --from=builder /go/src/gin-vue-admin/db.db ./
  28. COPY --from=builder /go/src/gin-vue-admin/config.yaml ./
  29. COPY --from=builder /go/src/gin-vue-admin/resource ./resource
  30. COPY docker/docker-start.sh ./
  31. ENV API_SERVER="http://localhost:8888/"
  32. EXPOSE 80
  33. ENTRYPOINT ["./docker-start.sh"]