提交 7267761c 编写于 作者: Sliver_Horn's avatar Sliver_Horn

新增docker-compose的支持,文档说明取消gopm,改用Go Modules主流的代理模式

上级 7352a0f7
......@@ -115,14 +115,18 @@ go get -u github.com/swaggo/swag/cmd/swag
````
##### (2)无法翻墙
由于国内没法安装 go.org/x 包下面的东西,需要先安装`gopm`
由于国内没法安装 go.org/x 包下面的东西,推荐使用 [goproxy.io](https://goproxy.io/zh/)
```bash
# 下载gopm包
go get -v -u github.com/gpmgo/gopm
如果您使用的 Go 版本是 1.13 及以上(推荐)
# 启用 Go Modules 功能
go env -w GO111MODULE=on
# 配置 GOPROXY 环境变量
go env -w GOPROXY=https://goproxy.io,direct
# 执行
gopm get -g -v github.com/swaggo/swag/cmd/swag
go get -g -v github.com/swaggo/swag/cmd/swag
# 到GOPATH的/src/github.com/swaggo/swag/cmd/swag路径下执行
go install
......
......@@ -116,14 +116,23 @@ go build
go get -u github.com/swaggo/swag/cmd/swag
````
##### (2) In mainland China
In mainland China, access to go.org/x is prohibited,we recommend `gopm`
##### (2) In mainland China
In mainland China, access to go.org/x is prohibited,we recommend [goproxy.io](https://goproxy.io/zh/)
````bash
# install gopm
go get -v -u github.com/gpmgo/gopm
If you are using Go version 1.13 and above (recommended)
# Enable Go Modules function
go env -w GO111MODULE=on
# Configure GOPROXY environment variables
go env -w GOPROXY=https://goproxy.io,direct
If you are using Go version 1.12 and below
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io
# get swag
gopm get -g -v github.com/swaggo/swag/cmd/swag
go get -g -v github.com/swaggo/swag/cmd/swag
# cd GOPATH/src/github.com/swaggo/swag/cmd/swag
go install
......
version: "3.8"
services:
server:
build:
context: ./
dockerfile: ./dockerfile_server
container_name: gva-server # 容器名
restart: always
ports:
- '8888:8888'
depends_on:
- mysql
- redis
mysql:
image: registry.cn-shanghai.aliyuncs.com/gva/gva-mysql:1.1
container_name: gva-mysql
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
restart: always
ports:
- "3306:3306" # host物理直接映射端口为6606
environment:
MYSQL_ROOT_PASSWORD: "Aa@6447985" # root管理员用户密码
redis:
image: redis:6.0.6
container_name: gva-redis # 容器名
restart: always
ports:
- '6379:6379'
\ No newline at end of file
FROM node:12.16.1 as gva-web
WORKDIR /gva_web/
COPY web/ .
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 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
# ```
\ No newline at end of file
......@@ -12,7 +12,7 @@ jwt:
mysql:
username: root
password: 'Aa@6447985'
path: '127.0.0.1:3306'
path: mysql
db-name: 'qmPlus'
config: 'charset=utf8&parseTime=True&loc=Local'
max-idle-conns: 10
......@@ -36,13 +36,13 @@ qiniu:
# redis configuration
redis:
addr: '127.0.0.1:6379'
addr: redis:6379
password: ''
db: 0
# system configuration
system:
use-multipoint: false
use-multipoint: true
env: 'public' # Change to "develop" to skip authentication for development mode
addr: 8888
db-type: "mysql" # support mysql/sqlite
......
......@@ -18,6 +18,7 @@ func RunWindowsServer() {
}
Router := initialize.Routers()
Router.Static("/form-generator", "./resource/page")
Router.Static("/admin", "./resource/dist")
//InstallPlugs(Router)
// end 插件描述
......
ENV = 'production'
VUE_APP_BASE_API = '/v1'
\ No newline at end of file
VUE_APP_BASE_API = ''
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册