forked from flipped-aurora/gin-vue-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile_server
63 lines (46 loc) · 1.36 KB
/
dockerfile_server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM node:12.16.1 as gva-web
WORKDIR /gva_web/
COPY web/ .
RUN cat .env.production
COPY docker/web-handle.sh .
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/server-handle.sh .
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
# ```