File tree Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Original file line number Diff line number Diff line change 1
- FROM centos:7.6.1810
1
+ FROM golang:alpine as builder
2
+ RUN apk add --update --no-cache yarn make g++
2
3
3
- # 设置go mod proxy 国内代理
4
- # 设置golang path
5
- ENV GOPROXY=https://goproxy.io GOPATH=/gopath PATH="${PATH}:/usr/local/go/bin"
6
- # 定义使用的Golang 版本
7
- ARG GO_VERSION=1.13.3
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 . .
10
+ RUN go env && go list && go build -v -a -ldflags "-extldflags \" -static\" " -o gvadmin .
8
11
9
- # 安装 golang 1.13.3
10
- RUN yum install -y wget && \
11
- yum install -y wqy-microhei-fonts wqy-zenhei-fonts && \
12
- wget "https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz" && \
13
- rm -rf /usr/local/go && \
14
- tar -C /usr/local -xzf "go$GO_VERSION.linux-amd64.tar.gz" && \
15
- rm -rf *.tar.gz && \
16
- go version && go env;
17
-
18
-
19
- WORKDIR $GOPATH
20
- COPY . gin-vue
21
-
22
- RUN cd gin-vue && go build -o app;
12
+ WORKDIR /app
13
+ COPY --from=builder /go/src/gin-vue-admin/gvadmin .
14
+ COPY --from=builder /go/src/gin-vue-admin/db.db .
15
+ COPY --from=builder /go/src/gin-vue-admin/config.yaml .
16
+ COPY --from=builder /go/src/gin-vue-admin/resource ./resource
23
17
24
18
EXPOSE 8888
25
19
26
- CMD ["gin-vue/app" ]
20
+ CMD ["gvadmin/app" ]
21
+
You can’t perform that action at this time.
0 commit comments