forked from flipped-aurora/gin-vue-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
rainyan
committed
Apr 27, 2020
1 parent
ca7d067
commit fee5407
Showing
4 changed files
with
58 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
FROM golang:alpine as builder | ||
RUN apk add --update --no-cache yarn make g++ | ||
FROM centos:7.6.1810 | ||
|
||
ENV GOPROXY=https://goproxy.cn,https://goproxy.io,direct \ | ||
GO111MODULE=on \ | ||
CGO_ENABLED=1 | ||
WORKDIR /go/src/gin-vue-admin | ||
RUN go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct | ||
COPY . . | ||
RUN go env && go list && go build -v -a -ldflags "-extldflags \"-static\" " -o gvadmin . | ||
# 设置go mod proxy 国内代理 | ||
# 设置golang path | ||
ENV GOPROXY=https://goproxy.io GOPATH=/gopath PATH="${PATH}:/usr/local/go/bin" | ||
# 定义使用的Golang 版本 | ||
ARG GO_VERSION=1.13.3 | ||
|
||
WORKDIR /app | ||
COPY --from=builder /go/src/gin-vue-admin/gvadmin . | ||
COPY --from=builder /go/src/gin-vue-admin/db.db . | ||
COPY --from=builder /go/src/gin-vue-admin/config.yaml . | ||
COPY --from=builder /go/src/gin-vue-admin/resource ./resource | ||
# 安装 golang 1.13.3 | ||
RUN yum install -y wget && \ | ||
wget "https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz" && \ | ||
rm -rf /usr/local/go && \ | ||
tar -C /usr/local -xzf "go$GO_VERSION.linux-amd64.tar.gz" && \ | ||
rm -rf *.tar.gz && \ | ||
go version && go env; | ||
|
||
EXPOSE 8888 | ||
WORKDIR $GOPATH | ||
COPY . ginvue | ||
|
||
RUN cd ginvue && go build -o app; | ||
|
||
CMD ["gvadmin/app"] | ||
COPY ./config.yaml $GOPATH/ginvue/ | ||
|
||
EXPOSE 8888 | ||
|
||
CMD ["ginvue/app"] |