Skip to content

World's first open-source enterprise world model.

CI publishes the image, so "one command" becomes true (#25)

WaylandYangb469d08af13a
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..054dc367
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,53 @@
+# 发布容器镜像到 ghcr.io。没有这个,README 承诺的"一条命令"实际是
+# "在自己机器上编译 Rust release + LTO 二十分钟,还得先拉得到 rust/node 基础镜像"。
+name: Release
+
+on:
+ push:
+ tags: ["v*"]
+ # 正式打 tag 之前先出一个可部署的镜像用
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: "Image tag to publish (e.g. 0.1.0-rc1)"
+ required: true
+
+permissions:
+ contents: read
+ packages: write
+
+jobs:
+ image:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: docker/setup-buildx-action@v3
+
+ - uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ghcr.io/${{ github.repository }}
+ tags: |
+ type=semver,pattern={{version}}
+ type=semver,pattern={{major}}.{{minor}}
+ type=raw,value=latest,enable=${{ github.ref_type == 'tag' }}
+ type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
+
+ # amd64 only:arm64 得走 QEMU,Rust release + LTO 会拖到一小时以上。
+ # 有人真需要再加,别让每次发版都等它。
+ - uses: docker/build-push-action@v6
+ with:
+ context: .
+ file: docker/Dockerfile
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
diff --git a/README.md b/README.md
index 866637ec..51616fde 100644
--- a/README.md
+++ b/README.md
@@ -46,11 +46,17 @@ Requirements: Docker (or Rust 1.85+, Node 20+ and pnpm for local development).
```bash
git clone https://github.com/deeplethe/utopia.git
cd utopia
-docker compose --profile app up -d --build
+docker compose --profile app up -d
```
Open http://localhost:8080 and register — the first account becomes the administrator. Then add an OpenAI-compatible endpoint under Settings, create a knowledge base, and drop in some files.
+That pulls a prebuilt image from `ghcr.io/deeplethe/utopia`. Uploaded files and the search index live in `./data`, so back that up alongside the database. To build from source instead — after changing code, or to run an unreleased revision:
+
+```bash
+docker compose -f docker-compose.yml -f docker-compose.build.yml --profile app up -d --build
+```
+
### Local development
```bash
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 2fd4d3df..33e8c7cf 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -46,11 +46,17 @@
```bash
git clone https://github.com/deeplethe/utopia.git
cd utopia
-docker compose --profile app up -d --build
+docker compose --profile app up -d
```
打开 http://localhost:8080 注册 —— 第一个账号即管理员。然后在设置里填一个 OpenAI 兼容端点,建一个知识库,把文件拖进去。
+这会从 `ghcr.io/deeplethe/utopia` 拉预构建镜像。上传的原始文件与全文索引在 `./data`,备份时和数据库一起带上。改了代码、或者想跑未发布的版本,则从源码构建:
+
+```bash
+docker compose -f docker-compose.yml -f docker-compose.build.yml --profile app up -d --build
+```
+
### 本地开发
```bash
diff --git a/docker-compose.build.yml b/docker-compose.build.yml
new file mode 100644
index 00000000..263a1854
--- /dev/null
+++ b/docker-compose.build.yml
@@ -0,0 +1,10 @@
+# 从源码构建,叠加在 docker-compose.yml 之上——改了代码,或者想跑未发布的版本时用:
+#
+# docker compose -f docker-compose.yml -f docker-compose.build.yml --profile app up -d --build
+#
+# 普通部署不需要这个文件,直接 docker compose --profile app up -d 拉预构建镜像。
+services:
+ app:
+ build:
+ context: .
+ dockerfile: docker/Dockerfile
diff --git a/docker-compose.yml b/docker-compose.yml
index d3a9ef63..1bae490b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -18,10 +18,11 @@ services:
# 完整部署:docker compose --profile app up -d
# 本地开发只起 db,应用用 cargo run 跑
+ #
+ # 这里只写 image 不写 build:两者并存时,本地没有镜像的 up 会去"构建"而不是
+ # "拉取",预构建镜像就白发了。要从源码起,叠加 docker-compose.build.yml。
app:
- build:
- context: .
- dockerfile: docker/Dockerfile
+ image: ${UTOPIA_IMAGE:-ghcr.io/deeplethe/utopia:latest}
profiles: ["app"]
environment:
UTOPIA_DATABASE_URL: postgres://utopia:utopia@db:5432/utopia