docs: update readme.md

pull/1107/head
Ink33 4 years ago
parent acc2fb905d
commit 24fdeff599
No known key found for this signature in database
GPG Key ID: 5D8B1D036EFB0D2E

@ -68,7 +68,7 @@ chmod +x ./cloudreve
## :gear: 构建 ## :gear: 构建
自行构建前需要拥有 `Go >= 1.13`、`yarn`等必要依赖。 自行构建前需要拥有 `Go >= 1.16`、`yarn`等必要依赖。
#### 克隆代码 #### 克隆代码
@ -85,30 +85,28 @@ cd assets
yarn install yarn install
# 开始构建 # 开始构建
yarn run build yarn run build
# 可选: 删除map文件
cd build
find . -name "*.map" | xargs rm -f
``` ```
#### 嵌入静态资源 #### 嵌入静态资源
```shell 当前版本无需手动嵌入静态资源,请直接进行下一步。
# 回到项目主目录
cd ../
# 安装 statik, 用于嵌入静态资源
go get github.com/rakyll/statik
# 开始嵌入
statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico -f
```
#### 编译项目 #### 编译项目
```shell ```shell
# 回到项目主目录
cd ../
# 获得当前版本号、Commit # 获得当前版本号、Commit
export COMMIT_SHA=$(git rev-parse --short HEAD) export COMMIT_SHA=$(git rev-parse --short HEAD)
export VERSION=$(git describe --tags) export VERSION=$(git describe --tags)
# 开始编译 # 开始编译
go build -a -o cloudreve -ldflags " -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" go build -a -o cloudreve -ldflags "-s -w -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'"
``` ```
你也可以使用项目根目录下的`build.sh`快速开始构建: 你也可以使用项目根目录下的`build.sh`快速开始构建:

Loading…
Cancel
Save