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.

65 lines
1.4 KiB

FROM node:12.16.1 as gva-web
WORKDIR /gva_web/
COPY web/ .
RUN cat .env.production
COPY .docker-compose/shell/web-handle.sh .
RUN ls -al
RUN sh ./web-handle.sh
RUN cat .env.production
RUN rm -f web-handle.sh
RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
RUN cnpm install || npm install
RUN npm run build
FROM golang:alpine as gva-server
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.io,direct
WORKDIR /go/src/gin-vue-admin
COPY server/ ./
RUN cat ./core/server.go
RUN cat ./config.yaml
COPY .docker-compose/shell/server-handle.sh .
RUN ls -al
RUN sh ./server-handle.sh
RUN rm -f server-handle.sh
RUN cat ./core/server.go
RUN cat ./config.yaml
RUN go env && go list && go build -o gva-server .
FROM nginx:alpine
LABEL MAINTAINER="SliverHorn"
WORKDIR gva/
# copy web
COPY --from=gva-web /gva_web/dist ./resource/dist
# copy server
COPY --from=gva-server /go/src/gin-vue-admin/gva-server ./
COPY --from=gva-server /go/src/gin-vue-admin/config.yaml ./
COPY --from=gva-server /go/src/gin-vue-admin/resource ./resource
EXPOSE 8888
ENTRYPOINT ./gva-server
# 根据Dockerfile生成Docker镜像
# docker build -t gva-server:1.0 .
#- 根据Docker镜像启动Docker容器
# - 后台运行
# - ```
# docker run -d -p 8888:8888 --name gva-server-v1 gva-server:1.0
# ```
# - 以可交互模式运行, Ctrl + p + q
# - ```
# docker run -it -p 8888:8888 --name gva-server-v1 gva-server:1.0
# ```