diff --git a/README.md b/README.md index 408f7b8c..3496f678 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ chmod +x ./cloudreve ## :gear: 构建 -自行构建前需要拥有 `Go >= 1.13`、`yarn`等必要依赖。 +自行构建前需要拥有 `Go >= 1.16`、`yarn`等必要依赖。 #### 克隆代码 @@ -85,30 +85,28 @@ cd assets yarn install # 开始构建 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 +# 回到项目主目录 +cd ../ + # 获得当前版本号、Commit export COMMIT_SHA=$(git rev-parse --short HEAD) 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`快速开始构建: