mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-22 02:45:28 +00:00
docs: add documentation about compilation (#138)
提供自编译可执行 JAR 和 Docker 镜像的文档。 Fixes https://github.com/halo-dev/docs/issues/114 /kind documentation ```release-note None ```
This commit is contained in:
103
docs/developer-guide/core/build.md
Normal file
103
docs/developer-guide/core/build.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
title: 构建
|
||||
description: 构建为可执行 JAR 和 Docker 镜像的文档
|
||||
---
|
||||
|
||||
:::info
|
||||
在此之前,我们推荐你先阅读[《准备工作》](./prepare),检查本地环境是否满足要求。
|
||||
:::
|
||||
|
||||
一般情况下,为了保证版本一致性和可维护性,我们并不推荐自行构建和二次开发。但考虑到我们目前仅提供 Docker 镜像的发行版本,不再提供可执行 JAR 的发行版本,因此我们提供了构建的文档,以供用户自行构建。
|
||||
|
||||
## 克隆项目
|
||||
|
||||
如果你已经 fork 了相关仓库,请将以下命令中的 halo-dev 替换为你的 GitHub 用户名。
|
||||
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/halo
|
||||
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/halo.git
|
||||
|
||||
# 切换到最新的 tag
|
||||
|
||||
cd halo
|
||||
|
||||
git checkout v2.0.0
|
||||
```
|
||||
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/console
|
||||
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/console.git
|
||||
|
||||
# 切换到最新的 tag
|
||||
|
||||
cd console
|
||||
|
||||
git checkout v2.0.0
|
||||
```
|
||||
|
||||
:::tip
|
||||
请务必按照以上要求切换到最新的 tag,而不是直接使用 main 分支构建,main 分支是我们的开发分支。此文档以 `2.0.0` 为例,查看最新的 tag 可使用 `git tag --column` 查看。
|
||||
:::
|
||||
|
||||
## 构建 Console
|
||||
|
||||
```bash
|
||||
cd path/to/console
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm build:packages
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
构建完成之后,在 console 目录下产生的 `dist` 目录即为构建完成的文件。最后将 `dist` 目录的所有文件复制到 halo 项目的 `src/main/resources/console` 目录。
|
||||
|
||||
## 构建 Fat Jar
|
||||
|
||||
构建之前需要修改 `gradle.properties` 中的 `version` 为当前 tag 的版本号,如:`version=2.0.0`
|
||||
|
||||
```bash
|
||||
cd path/to/halo
|
||||
```
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
./gradlew.bat clean build -x check -x jar
|
||||
|
||||
# macOS / Linux
|
||||
./gradlew clean build -x check -x jar
|
||||
```
|
||||
|
||||
构建完成之后,在 halo 项目下产生的 `build/libs/halo-2.0.0.jar` 即为构建完成的文件。
|
||||
|
||||
## 构建 Docker 镜像
|
||||
|
||||
在进行之前,请确保已经完成上述操作,最终需要确认在 halo 项目的 `build/libs/` 目录已经包含了 `halo-2.0.0.jar` 文件。
|
||||
|
||||
```bash
|
||||
cd path/to/halo
|
||||
```
|
||||
|
||||
```bash
|
||||
docker build -t halo-dev/halo:2.0.0 .
|
||||
```
|
||||
|
||||
```bash
|
||||
# 插件构建完成的版本
|
||||
docker images | grep halo
|
||||
```
|
||||
|
||||
最终部署文档可参考:[使用 Docker Compose 部署](./docker-compose)
|
@@ -6,10 +6,11 @@ description: 开发环境的准备工作
|
||||
## 环境要求
|
||||
|
||||
- [OpenJDK 17 LTS](https://github.com/openjdk/jdk)
|
||||
- [Node.js 16 LTS](https://nodejs.org)
|
||||
- [Node.js 18 LTS](https://nodejs.org)
|
||||
- [pnpm 7](https://pnpm.io/)
|
||||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/)
|
||||
- [Git](https://git-scm.com/)
|
||||
- [Docker](https://www.docker.com/)(可选)
|
||||
|
||||
## 名词解释
|
||||
|
||||
|
@@ -26,7 +26,7 @@ description: 开发环境运行的指南
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/halo
|
||||
|
||||
或者使用 ssh 的方式 clone(推荐)
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/halo.git
|
||||
```
|
||||
@@ -34,7 +34,7 @@ git clone git@github.com:halo-dev/halo.git
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/console
|
||||
|
||||
或者使用 ssh 的方式 clone(推荐)
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/console.git
|
||||
```
|
||||
|
@@ -83,6 +83,7 @@ module.exports = {
|
||||
// "developer-guide/core/structure",
|
||||
"developer-guide/core/prepare",
|
||||
"developer-guide/core/run",
|
||||
"developer-guide/core/build",
|
||||
// "developer-guide/core/code-style",
|
||||
],
|
||||
},
|
||||
|
103
versioned_docs/version-2.0/developer-guide/core/build.md
Normal file
103
versioned_docs/version-2.0/developer-guide/core/build.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
title: 构建
|
||||
description: 构建为可执行 JAR 和 Docker 镜像的文档
|
||||
---
|
||||
|
||||
:::info
|
||||
在此之前,我们推荐你先阅读[《准备工作》](./prepare),检查本地环境是否满足要求。
|
||||
:::
|
||||
|
||||
一般情况下,为了保证版本一致性和可维护性,我们并不推荐自行构建和二次开发。但考虑到我们目前仅提供 Docker 镜像的发行版本,不再提供可执行 JAR 的发行版本,因此我们提供了构建的文档,以供用户自行构建。
|
||||
|
||||
## 克隆项目
|
||||
|
||||
如果你已经 fork 了相关仓库,请将以下命令中的 halo-dev 替换为你的 GitHub 用户名。
|
||||
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/halo
|
||||
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/halo.git
|
||||
|
||||
# 切换到最新的 tag
|
||||
|
||||
cd halo
|
||||
|
||||
git checkout v2.0.0
|
||||
```
|
||||
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/console
|
||||
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/console.git
|
||||
|
||||
# 切换到最新的 tag
|
||||
|
||||
cd console
|
||||
|
||||
git checkout v2.0.0
|
||||
```
|
||||
|
||||
:::tip
|
||||
请务必按照以上要求切换到最新的 tag,而不是直接使用 main 分支构建,main 分支是我们的开发分支。此文档以 `2.0.0` 为例,查看最新的 tag 可使用 `git tag --column` 查看。
|
||||
:::
|
||||
|
||||
## 构建 Console
|
||||
|
||||
```bash
|
||||
cd path/to/console
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm build:packages
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
构建完成之后,在 console 目录下产生的 `dist` 目录即为构建完成的文件。最后将 `dist` 目录的所有文件复制到 halo 项目的 `src/main/resources/console` 目录。
|
||||
|
||||
## 构建 Fat Jar
|
||||
|
||||
构建之前需要修改 `gradle.properties` 中的 `version` 为当前 tag 的版本号,如:`version=2.0.0`
|
||||
|
||||
```bash
|
||||
cd path/to/halo
|
||||
```
|
||||
|
||||
```bash
|
||||
# Windows
|
||||
./gradlew.bat clean build -x check -x jar
|
||||
|
||||
# macOS / Linux
|
||||
./gradlew clean build -x check -x jar
|
||||
```
|
||||
|
||||
构建完成之后,在 halo 项目下产生的 `build/libs/halo-2.0.0.jar` 即为构建完成的文件。
|
||||
|
||||
## 构建 Docker 镜像
|
||||
|
||||
在进行之前,请确保已经完成上述操作,最终需要确认在 halo 项目的 `build/libs/` 目录已经包含了 `halo-2.0.0.jar` 文件。
|
||||
|
||||
```bash
|
||||
cd path/to/halo
|
||||
```
|
||||
|
||||
```bash
|
||||
docker build -t halo-dev/halo:2.0.0 .
|
||||
```
|
||||
|
||||
```bash
|
||||
# 插件构建完成的版本
|
||||
docker images | grep halo
|
||||
```
|
||||
|
||||
最终部署文档可参考:[使用 Docker Compose 部署](./docker-compose)
|
@@ -6,10 +6,11 @@ description: 开发环境的准备工作
|
||||
## 环境要求
|
||||
|
||||
- [OpenJDK 17 LTS](https://github.com/openjdk/jdk)
|
||||
- [Node.js 16 LTS](https://nodejs.org)
|
||||
- [Node.js 18 LTS](https://nodejs.org)
|
||||
- [pnpm 7](https://pnpm.io/)
|
||||
- [IntelliJ IDEA](https://www.jetbrains.com/idea/)
|
||||
- [Git](https://git-scm.com/)
|
||||
- [Docker](https://www.docker.com/)(可选)
|
||||
|
||||
## 名词解释
|
||||
|
||||
|
@@ -26,7 +26,7 @@ description: 开发环境运行的指南
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/halo
|
||||
|
||||
或者使用 ssh 的方式 clone(推荐)
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/halo.git
|
||||
```
|
||||
@@ -34,7 +34,7 @@ git clone git@github.com:halo-dev/halo.git
|
||||
```bash
|
||||
git clone https://github.com/halo-dev/console
|
||||
|
||||
或者使用 ssh 的方式 clone(推荐)
|
||||
# 或者使用 ssh 的方式 clone(推荐)
|
||||
|
||||
git clone git@github.com:halo-dev/console.git
|
||||
```
|
||||
|
@@ -61,7 +61,11 @@
|
||||
"link": {
|
||||
"type": "generated-index"
|
||||
},
|
||||
"items": ["developer-guide/core/prepare", "developer-guide/core/run"]
|
||||
"items": [
|
||||
"developer-guide/core/prepare",
|
||||
"developer-guide/core/run",
|
||||
"developer-guide/core/build"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "category",
|
||||
|
Reference in New Issue
Block a user