@lobehub/chat 1.142.8 → 1.143.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ concurrency:
14
14
  cancel-in-progress: true
15
15
 
16
16
  env:
17
- REGISTRY_IMAGE: lobehub/lobe-chat
17
+ REGISTRY_IMAGE: lobehub/lobehub
18
18
  PR_TAG_PREFIX: pr-
19
19
 
20
20
  jobs:
@@ -86,7 +86,7 @@ jobs:
86
86
  with:
87
87
  platforms: ${{ matrix.platform }}
88
88
  context: .
89
- file: ./Dockerfile
89
+ file: ./Dockerfile.database
90
90
  labels: ${{ steps.meta.outputs.labels }}
91
91
  build-args: |
92
92
  SHA=${{ steps.vars.outputs.sha_short }}
@@ -161,3 +161,21 @@ jobs:
161
161
  - name: Inspect image
162
162
  run: |
163
163
  docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
164
+
165
+ - name: Comment on PR with Docker build info
166
+ if: github.event_name == 'pull_request'
167
+ uses: actions/github-script@v8
168
+ with:
169
+ github-token: ${{ secrets.GITHUB_TOKEN }}
170
+ script: |
171
+ const prComment = require('${{ github.workspace }}/.github/scripts/docker-pr-comment.js');
172
+ const result = await prComment({
173
+ github,
174
+ context,
175
+ dockerMetaJson: ${{ toJSON(steps.meta.outputs.json) }},
176
+ image: "${{ env.REGISTRY_IMAGE }}",
177
+ version: "${{ steps.meta.outputs.version }}",
178
+ dockerhubUrl: "https://hub.docker.com/r/${{ env.REGISTRY_IMAGE }}/tags",
179
+ platforms: "linux/amd64, linux/arm64",
180
+ });
181
+ core.info(`Status: ${result.updated ? 'Updated' : 'Created'}, ID: ${result.id}`);
@@ -9,6 +9,7 @@ on:
9
9
  push:
10
10
  branches:
11
11
  - main
12
+ - next
12
13
 
13
14
  jobs:
14
15
  release:
package/.releaserc.cjs CHANGED
@@ -1,5 +1,13 @@
1
1
  const config = require('@lobehub/lint').semanticRelease;
2
2
 
3
+ config.branches = [
4
+ 'main',
5
+ {
6
+ name: 'next',
7
+ prerelease: true,
8
+ },
9
+ ];
10
+
3
11
  config.plugins.push([
4
12
  '@semantic-release/exec',
5
13
  {
package/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.143.0-next.1](https://github.com/lobehub/lobe-chat/compare/v1.142.8...v1.143.0-next.1)
6
+
7
+ <sup>Released on **2025-10-30**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Try 2.0 next.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Try 2.0 next ([e0af4e6](https://github.com/lobehub/lobe-chat/commit/e0af4e6))
21
+
22
+ </details>
23
+
24
+ #### 💥 BREAKING CHANGES
25
+
26
+ - **misc**: starting V2
27
+
28
+ <div align="right">
29
+
30
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
31
+
32
+ </div>
33
+
5
34
  ### [Version 1.142.8](https://github.com/lobehub/lobe-chat/compare/v1.142.7...v1.142.8)
6
35
 
7
36
  <sup>Released on **2025-10-30**</sup>
package/Dockerfile CHANGED
@@ -37,6 +37,10 @@ FROM base AS builder
37
37
 
38
38
  ARG USE_CN_MIRROR
39
39
  ARG NEXT_PUBLIC_BASE_PATH
40
+ ARG NEXT_PUBLIC_SERVICE_MODE
41
+ ARG NEXT_PUBLIC_ENABLE_NEXT_AUTH
42
+ ARG NEXT_PUBLIC_ENABLE_CLERK_AUTH
43
+ ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
40
44
  ARG NEXT_PUBLIC_SENTRY_DSN
41
45
  ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
42
46
  ARG NEXT_PUBLIC_POSTHOG_HOST
@@ -48,13 +52,22 @@ ARG FEATURE_FLAGS
48
52
 
49
53
  ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
50
54
  FEATURE_FLAGS="${FEATURE_FLAGS}"
55
+
56
+ ENV NEXT_PUBLIC_SERVICE_MODE="${NEXT_PUBLIC_SERVICE_MODE:-server}" \
57
+ NEXT_PUBLIC_ENABLE_NEXT_AUTH="${NEXT_PUBLIC_ENABLE_NEXT_AUTH:-1}" \
58
+ NEXT_PUBLIC_ENABLE_CLERK_AUTH="${NEXT_PUBLIC_ENABLE_CLERK_AUTH:-0}" \
59
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}" \
60
+ CLERK_WEBHOOK_SECRET="whsec_xxx" \
61
+ APP_URL="http://app.com" \
62
+ DATABASE_DRIVER="node" \
63
+ DATABASE_URL="postgres://postgres:password@localhost:5432/postgres" \
64
+ KEY_VAULTS_SECRET="use-for-build"
65
+
51
66
  # Sentry
52
67
  ENV NEXT_PUBLIC_SENTRY_DSN="${NEXT_PUBLIC_SENTRY_DSN}" \
53
68
  SENTRY_ORG="" \
54
69
  SENTRY_PROJECT=""
55
70
 
56
- ENV APP_URL="http://app.com"
57
-
58
71
  # Posthog
59
72
  ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="${NEXT_PUBLIC_ANALYTICS_POSTHOG}" \
60
73
  NEXT_PUBLIC_POSTHOG_HOST="${NEXT_PUBLIC_POSTHOG_HOST}" \
@@ -90,7 +103,12 @@ RUN \
90
103
  # Use pnpm for corepack
91
104
  && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
92
105
  # Install the dependencies
93
- && pnpm i
106
+ && pnpm i \
107
+ # Add db migration dependencies
108
+ && mkdir -p /deps \
109
+ && cd /deps \
110
+ && pnpm init \
111
+ && pnpm add pg drizzle-orm
94
112
 
95
113
  COPY . .
96
114
 
@@ -106,6 +124,16 @@ COPY --from=base /distroless/ /
106
124
  # https://nextjs.org/docs/advanced-features/output-file-tracing
107
125
  COPY --from=builder /app/.next/standalone /app/
108
126
 
127
+ # Copy database migrations
128
+ COPY --from=builder /app/packages/database/migrations /app/migrations
129
+ COPY --from=builder /app/scripts/migrateServerDB/docker.cjs /app/docker.cjs
130
+ COPY --from=builder /app/scripts/migrateServerDB/errorHint.js /app/errorHint.js
131
+
132
+ # copy dependencies
133
+ COPY --from=builder /deps/node_modules/.pnpm /app/node_modules/.pnpm
134
+ COPY --from=builder /deps/node_modules/pg /app/node_modules/pg
135
+ COPY --from=builder /deps/node_modules/drizzle-orm /app/node_modules/drizzle-orm
136
+
109
137
  # Copy server launcher
110
138
  COPY --from=builder /app/scripts/serverLauncher/startServer.js /app/startServer.js
111
139
 
@@ -138,6 +166,7 @@ ENV HOSTNAME="0.0.0.0" \
138
166
 
139
167
  # General Variables
140
168
  ENV ACCESS_CODE="" \
169
+ APP_URL="" \
141
170
  API_KEY_SELECT_MODE="" \
142
171
  DEFAULT_AGENT_CONFIG="" \
143
172
  SYSTEM_AGENT="" \
@@ -145,6 +174,30 @@ ENV ACCESS_CODE="" \
145
174
  PROXY_URL="" \
146
175
  ENABLE_AUTH_PROTECTION=""
147
176
 
177
+ # Database
178
+ ENV KEY_VAULTS_SECRET="" \
179
+ DATABASE_DRIVER="node" \
180
+ DATABASE_URL=""
181
+
182
+ # Next Auth
183
+ ENV NEXT_AUTH_SECRET="" \
184
+ NEXT_AUTH_SSO_PROVIDERS="" \
185
+ NEXTAUTH_URL=""
186
+
187
+ # Clerk
188
+ ENV CLERK_SECRET_KEY="" \
189
+ CLERK_WEBHOOK_SECRET=""
190
+
191
+ # S3
192
+ ENV NEXT_PUBLIC_S3_DOMAIN="" \
193
+ S3_PUBLIC_DOMAIN="" \
194
+ S3_ACCESS_KEY_ID="" \
195
+ S3_BUCKET="" \
196
+ S3_ENDPOINT="" \
197
+ S3_SECRET_ACCESS_KEY="" \
198
+ S3_ENABLE_PATH_STYLE="" \
199
+ S3_SET_ACL=""
200
+
148
201
  # Model Variables
149
202
  ENV \
150
203
  # AI21
@@ -263,7 +316,9 @@ ENV \
263
316
  # BFL
264
317
  BFL_API_KEY="" BFL_MODEL_LIST="" \
265
318
  # Vercel AI Gateway
266
- VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST=""
319
+ VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST="" \
320
+ # Cerebras
321
+ CEREBRAS_API_KEY="" CEREBRAS_MODEL_LIST=""
267
322
 
268
323
  USER nextjs
269
324
 
package/changelog/v1.json CHANGED
@@ -1,4 +1,16 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Try 2.0 next."
6
+ ],
7
+ "improvements": [
8
+ "starting V2"
9
+ ]
10
+ },
11
+ "date": "2025-10-30",
12
+ "version": "1.143.0-next.1"
13
+ },
2
14
  {
3
15
  "children": {},
4
16
  "date": "2025-10-30",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "1.142.8",
3
+ "version": "1.143.0-next.1",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -73,9 +73,9 @@
73
73
  "reinstall": "rm -rf pnpm-lock.yaml && rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm install",
74
74
  "reinstall:desktop": "rm -rf pnpm-lock.yaml && rm -rf node_modules && pnpm -r exec rm -rf node_modules && pnpm install --node-linker=hoisted",
75
75
  "release": "semantic-release",
76
- "self-hosting:docker": "docker build -t lobe-chat:local .",
77
- "self-hosting:docker-cn": "docker build -t lobe-chat-local --build-arg USE_CN_MIRROR=true .",
78
- "self-hosting:docker-cn@database": "docker build -t lobe-chat-database-local -f Dockerfile.database --build-arg USE_CN_MIRROR=true .",
76
+ "self-hosting:docker": "docker build -t lobehub:local .",
77
+ "self-hosting:docker-cn": "docker build -t lobehub-local --build-arg USE_CN_MIRROR=true .",
78
+ "self-hosting:docker-cn@lite": "docker build -t lobehub-lite-local -f Dockerfile.lite --build-arg USE_CN_MIRROR=true .",
79
79
  "start": "next start -p 3210",
80
80
  "stylelint": "stylelint \"src/**/*.{js,jsx,ts,tsx}\" --fix",
81
81
  "test": "npm run test-app && npm run test-server",
@@ -1,181 +0,0 @@
1
- name: Publish Database Docker Image
2
- permissions:
3
- contents: read
4
-
5
- on:
6
- workflow_dispatch:
7
- release:
8
- types: [published]
9
- pull_request:
10
- types: [synchronize, labeled, unlabeled]
11
-
12
- concurrency:
13
- group: ${{ github.ref }}-${{ github.workflow }}
14
- cancel-in-progress: true
15
-
16
- env:
17
- REGISTRY_IMAGE: lobehub/lobe-chat-database
18
- PR_TAG_PREFIX: pr-
19
-
20
- jobs:
21
- build:
22
- # 添加 PR label 触发条件
23
- if: |
24
- (github.event_name == 'pull_request' &&
25
- contains(github.event.pull_request.labels.*.name, 'trigger:build-docker')) ||
26
- github.event_name != 'pull_request'
27
-
28
- strategy:
29
- matrix:
30
- include:
31
- - platform: linux/amd64
32
- os: ubuntu-latest
33
- - platform: linux/arm64
34
- os: ubuntu-24.04-arm
35
- runs-on: ${{ matrix.os }}
36
- name: Build ${{ matrix.platform }} Image
37
- steps:
38
- - name: Prepare
39
- run: |
40
- platform=${{ matrix.platform }}
41
- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
42
-
43
- - name: Checkout base
44
- uses: actions/checkout@v5
45
- with:
46
- fetch-depth: 0
47
-
48
- - name: Set up Docker Buildx
49
- uses: docker/setup-buildx-action@v3
50
-
51
- # 为 PR 生成特殊的 tag
52
- - name: Generate PR metadata
53
- if: github.event_name == 'pull_request'
54
- id: pr_meta
55
- run: |
56
- branch_name="${{ github.head_ref }}"
57
- sanitized_branch=$(echo "${branch_name}" | sed -E 's/[^a-zA-Z0-9_.-]+/-/g')
58
- echo "pr_tag=${sanitized_branch}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
59
-
60
- - name: Docker meta
61
- id: meta
62
- uses: docker/metadata-action@v5
63
- with:
64
- images: ${{ env.REGISTRY_IMAGE }}
65
- tags: |
66
- # PR 构建使用特殊的 tag
67
- type=raw,value=${{ env.PR_TAG_PREFIX }}${{ steps.pr_meta.outputs.pr_tag }},enable=${{ github.event_name == 'pull_request' }}
68
- # release 构建使用版本号
69
- type=semver,pattern={{version}},enable=${{ github.event_name != 'pull_request' }}
70
- type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
71
-
72
- - name: Docker login
73
- uses: docker/login-action@v3
74
- with:
75
- username: ${{ secrets.DOCKER_REGISTRY_USER }}
76
- password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
77
-
78
- - name: Get commit SHA
79
- if: github.ref == 'refs/heads/main'
80
- id: vars
81
- run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
82
-
83
- - name: Build and export
84
- id: build
85
- uses: docker/build-push-action@v6
86
- with:
87
- platforms: ${{ matrix.platform }}
88
- context: .
89
- file: ./Dockerfile.database
90
- labels: ${{ steps.meta.outputs.labels }}
91
- build-args: |
92
- SHA=${{ steps.vars.outputs.sha_short }}
93
- outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
94
-
95
- - name: Export digest
96
- run: |
97
- rm -rf /tmp/digests
98
- mkdir -p /tmp/digests
99
- digest="${{ steps.build.outputs.digest }}"
100
- touch "/tmp/digests/${digest#sha256:}"
101
-
102
- - name: Upload artifact
103
- uses: actions/upload-artifact@v4
104
- with:
105
- name: digest-${{ env.PLATFORM_PAIR }}
106
- path: /tmp/digests/*
107
- if-no-files-found: error
108
- retention-days: 1
109
-
110
- merge:
111
- name: Merge
112
- needs: build
113
- runs-on: ubuntu-latest
114
- steps:
115
- - name: Checkout base
116
- uses: actions/checkout@v5
117
- with:
118
- fetch-depth: 0
119
-
120
- - name: Download digests
121
- uses: actions/download-artifact@v5
122
- with:
123
- path: /tmp/digests
124
- pattern: digest-*
125
- merge-multiple: true
126
-
127
- - name: Set up Docker Buildx
128
- uses: docker/setup-buildx-action@v3
129
-
130
- # 为 merge job 添加 PR metadata 生成
131
- - name: Generate PR metadata
132
- if: github.event_name == 'pull_request'
133
- id: pr_meta
134
- run: |
135
- branch_name="${{ github.head_ref }}"
136
- sanitized_branch=$(echo "${branch_name}" | sed -E 's/[^a-zA-Z0-9_.-]+/-/g')
137
- echo "pr_tag=${sanitized_branch}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
138
-
139
- - name: Docker meta
140
- id: meta
141
- uses: docker/metadata-action@v5
142
- with:
143
- images: ${{ env.REGISTRY_IMAGE }}
144
- tags: |
145
- type=raw,value=${{ env.PR_TAG_PREFIX }}${{ steps.pr_meta.outputs.pr_tag }},enable=${{ github.event_name == 'pull_request' }}
146
- type=semver,pattern={{version}},enable=${{ github.event_name != 'pull_request' }}
147
- type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
148
-
149
- - name: Docker login
150
- uses: docker/login-action@v3
151
- with:
152
- username: ${{ secrets.DOCKER_REGISTRY_USER }}
153
- password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
154
-
155
- - name: Create manifest list and push
156
- working-directory: /tmp/digests
157
- run: |
158
- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
159
- $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
160
-
161
- - name: Inspect image
162
- run: |
163
- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
164
-
165
- - name: Comment on PR with Docker build info
166
- if: github.event_name == 'pull_request'
167
- uses: actions/github-script@v8
168
- with:
169
- github-token: ${{ secrets.GITHUB_TOKEN }}
170
- script: |
171
- const prComment = require('${{ github.workspace }}/.github/scripts/docker-pr-comment.js');
172
- const result = await prComment({
173
- github,
174
- context,
175
- dockerMetaJson: ${{ toJSON(steps.meta.outputs.json) }},
176
- image: "${{ env.REGISTRY_IMAGE }}",
177
- version: "${{ steps.meta.outputs.version }}",
178
- dockerhubUrl: "https://hub.docker.com/r/${{ env.REGISTRY_IMAGE }}/tags",
179
- platforms: "linux/amd64, linux/arm64",
180
- });
181
- core.info(`Status: ${result.updated ? 'Updated' : 'Created'}, ID: ${result.id}`);
@@ -1,163 +0,0 @@
1
- name: Publish Docker Pglite Image
2
- permissions:
3
- contents: read
4
-
5
- on:
6
- workflow_dispatch:
7
- release:
8
- types: [published]
9
- pull_request:
10
- types: [synchronize, labeled, unlabeled]
11
-
12
- concurrency:
13
- group: ${{ github.ref }}-${{ github.workflow }}
14
- cancel-in-progress: true
15
-
16
- env:
17
- REGISTRY_IMAGE: lobehub/lobe-chat-pglite
18
- PR_TAG_PREFIX: pr-
19
-
20
- jobs:
21
- build:
22
- # 添加 PR label 触发条件
23
- if: |
24
- (github.event_name == 'pull_request' &&
25
- contains(github.event.pull_request.labels.*.name, 'trigger:build-docker')) ||
26
- github.event_name != 'pull_request'
27
-
28
- strategy:
29
- matrix:
30
- include:
31
- - platform: linux/amd64
32
- os: ubuntu-latest
33
- - platform: linux/arm64
34
- os: ubuntu-24.04-arm
35
- runs-on: ${{ matrix.os }}
36
- name: Build ${{ matrix.platform }} Image
37
- steps:
38
- - name: Prepare
39
- run: |
40
- platform=${{ matrix.platform }}
41
- echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
42
-
43
- - name: Checkout base
44
- uses: actions/checkout@v5
45
- with:
46
- fetch-depth: 0
47
-
48
- - name: Set up Docker Buildx
49
- uses: docker/setup-buildx-action@v3
50
-
51
- # 为 PR 生成特殊的 tag
52
- - name: Generate PR metadata
53
- if: github.event_name == 'pull_request'
54
- id: pr_meta
55
- run: |
56
- branch_name="${{ github.head_ref }}"
57
- sanitized_branch=$(echo "${branch_name}" | sed -E 's/[^a-zA-Z0-9_.-]+/-/g')
58
- echo "pr_tag=${sanitized_branch}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
59
-
60
- - name: Docker meta
61
- id: meta
62
- uses: docker/metadata-action@v5
63
- with:
64
- images: ${{ env.REGISTRY_IMAGE }}
65
- tags: |
66
- # PR 构建使用特殊的 tag
67
- type=raw,value=${{ env.PR_TAG_PREFIX }}${{ steps.pr_meta.outputs.pr_tag }},enable=${{ github.event_name == 'pull_request' }}
68
- # release 构建使用版本号
69
- type=semver,pattern={{version}},enable=${{ github.event_name != 'pull_request' }}
70
- type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
71
-
72
- - name: Docker login
73
- uses: docker/login-action@v3
74
- with:
75
- username: ${{ secrets.DOCKER_REGISTRY_USER }}
76
- password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
77
-
78
- - name: Get commit SHA
79
- if: github.ref == 'refs/heads/main'
80
- id: vars
81
- run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
82
-
83
- - name: Build and export
84
- id: build
85
- uses: docker/build-push-action@v6
86
- with:
87
- platforms: ${{ matrix.platform }}
88
- context: .
89
- file: ./Dockerfile.pglite
90
- labels: ${{ steps.meta.outputs.labels }}
91
- build-args: |
92
- SHA=${{ steps.vars.outputs.sha_short }}
93
- outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
94
-
95
- - name: Export digest
96
- run: |
97
- rm -rf /tmp/digests
98
- mkdir -p /tmp/digests
99
- digest="${{ steps.build.outputs.digest }}"
100
- touch "/tmp/digests/${digest#sha256:}"
101
-
102
- - name: Upload artifact
103
- uses: actions/upload-artifact@v4
104
- with:
105
- name: digest-${{ env.PLATFORM_PAIR }}
106
- path: /tmp/digests/*
107
- if-no-files-found: error
108
- retention-days: 1
109
-
110
- merge:
111
- name: Merge
112
- needs: build
113
- runs-on: ubuntu-latest
114
- steps:
115
- - name: Checkout base
116
- uses: actions/checkout@v5
117
- with:
118
- fetch-depth: 0
119
-
120
- - name: Download digests
121
- uses: actions/download-artifact@v5
122
- with:
123
- path: /tmp/digests
124
- pattern: digest-*
125
- merge-multiple: true
126
-
127
- - name: Set up Docker Buildx
128
- uses: docker/setup-buildx-action@v3
129
-
130
- # 为 merge job 添加 PR metadata 生成
131
- - name: Generate PR metadata
132
- if: github.event_name == 'pull_request'
133
- id: pr_meta
134
- run: |
135
- branch_name="${{ github.head_ref }}"
136
- sanitized_branch=$(echo "${branch_name}" | sed -E 's/[^a-zA-Z0-9_.-]+/-/g')
137
- echo "pr_tag=${sanitized_branch}-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
138
-
139
- - name: Docker meta
140
- id: meta
141
- uses: docker/metadata-action@v5
142
- with:
143
- images: ${{ env.REGISTRY_IMAGE }}
144
- tags: |
145
- type=raw,value=${{ env.PR_TAG_PREFIX }}${{ steps.pr_meta.outputs.pr_tag }},enable=${{ github.event_name == 'pull_request' }}
146
- type=semver,pattern={{version}},enable=${{ github.event_name != 'pull_request' }}
147
- type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }}
148
-
149
- - name: Docker login
150
- uses: docker/login-action@v3
151
- with:
152
- username: ${{ secrets.DOCKER_REGISTRY_USER }}
153
- password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
154
-
155
- - name: Create manifest list and push
156
- working-directory: /tmp/digests
157
- run: |
158
- docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
159
- $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
160
-
161
- - name: Inspect image
162
- run: |
163
- docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
@@ -1,329 +0,0 @@
1
- ## Set global build ENV
2
- ARG NODEJS_VERSION="24"
3
-
4
- ## Base image for all building stages
5
- FROM node:${NODEJS_VERSION}-slim AS base
6
-
7
- ARG USE_CN_MIRROR
8
-
9
- ENV DEBIAN_FRONTEND="noninteractive"
10
-
11
- RUN \
12
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
13
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
14
- sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" "/etc/apt/sources.list.d/debian.sources"; \
15
- fi \
16
- # Add required package
17
- && apt update \
18
- && apt install ca-certificates proxychains-ng -qy \
19
- # Prepare required package to distroless
20
- && mkdir -p /distroless/bin /distroless/etc /distroless/etc/ssl/certs /distroless/lib \
21
- # Copy proxychains to distroless
22
- && cp /usr/lib/$(arch)-linux-gnu/libproxychains.so.4 /distroless/lib/libproxychains.so.4 \
23
- && cp /usr/lib/$(arch)-linux-gnu/libdl.so.2 /distroless/lib/libdl.so.2 \
24
- && cp /usr/bin/proxychains4 /distroless/bin/proxychains \
25
- && cp /etc/proxychains4.conf /distroless/etc/proxychains4.conf \
26
- # Copy node to distroless
27
- && cp /usr/lib/$(arch)-linux-gnu/libstdc++.so.6 /distroless/lib/libstdc++.so.6 \
28
- && cp /usr/lib/$(arch)-linux-gnu/libgcc_s.so.1 /distroless/lib/libgcc_s.so.1 \
29
- && cp /usr/local/bin/node /distroless/bin/node \
30
- # Copy CA certificates to distroless
31
- && cp /etc/ssl/certs/ca-certificates.crt /distroless/etc/ssl/certs/ca-certificates.crt \
32
- # Cleanup temp files
33
- && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
34
-
35
- ## Builder image, install all the dependencies and build the app
36
- FROM base AS builder
37
-
38
- ARG USE_CN_MIRROR
39
- ARG NEXT_PUBLIC_BASE_PATH
40
- ARG NEXT_PUBLIC_SERVICE_MODE
41
- ARG NEXT_PUBLIC_ENABLE_NEXT_AUTH
42
- ARG NEXT_PUBLIC_ENABLE_CLERK_AUTH
43
- ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
44
- ARG NEXT_PUBLIC_SENTRY_DSN
45
- ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
46
- ARG NEXT_PUBLIC_POSTHOG_HOST
47
- ARG NEXT_PUBLIC_POSTHOG_KEY
48
- ARG NEXT_PUBLIC_ANALYTICS_UMAMI
49
- ARG NEXT_PUBLIC_UMAMI_SCRIPT_URL
50
- ARG NEXT_PUBLIC_UMAMI_WEBSITE_ID
51
- ARG FEATURE_FLAGS
52
-
53
- ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
54
- FEATURE_FLAGS="${FEATURE_FLAGS}"
55
-
56
- ENV NEXT_PUBLIC_SERVICE_MODE="${NEXT_PUBLIC_SERVICE_MODE:-server}" \
57
- NEXT_PUBLIC_ENABLE_NEXT_AUTH="${NEXT_PUBLIC_ENABLE_NEXT_AUTH:-1}" \
58
- NEXT_PUBLIC_ENABLE_CLERK_AUTH="${NEXT_PUBLIC_ENABLE_CLERK_AUTH:-0}" \
59
- NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="${NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}" \
60
- CLERK_WEBHOOK_SECRET="whsec_xxx" \
61
- APP_URL="http://app.com" \
62
- DATABASE_DRIVER="node" \
63
- DATABASE_URL="postgres://postgres:password@localhost:5432/postgres" \
64
- KEY_VAULTS_SECRET="use-for-build"
65
-
66
- # Sentry
67
- ENV NEXT_PUBLIC_SENTRY_DSN="${NEXT_PUBLIC_SENTRY_DSN}" \
68
- SENTRY_ORG="" \
69
- SENTRY_PROJECT=""
70
-
71
- # Posthog
72
- ENV NEXT_PUBLIC_ANALYTICS_POSTHOG="${NEXT_PUBLIC_ANALYTICS_POSTHOG}" \
73
- NEXT_PUBLIC_POSTHOG_HOST="${NEXT_PUBLIC_POSTHOG_HOST}" \
74
- NEXT_PUBLIC_POSTHOG_KEY="${NEXT_PUBLIC_POSTHOG_KEY}"
75
-
76
- # Umami
77
- ENV NEXT_PUBLIC_ANALYTICS_UMAMI="${NEXT_PUBLIC_ANALYTICS_UMAMI}" \
78
- NEXT_PUBLIC_UMAMI_SCRIPT_URL="${NEXT_PUBLIC_UMAMI_SCRIPT_URL}" \
79
- NEXT_PUBLIC_UMAMI_WEBSITE_ID="${NEXT_PUBLIC_UMAMI_WEBSITE_ID}"
80
-
81
- # Node
82
- ENV NODE_OPTIONS="--max-old-space-size=6144"
83
-
84
- WORKDIR /app
85
-
86
- COPY package.json pnpm-workspace.yaml ./
87
- COPY .npmrc ./
88
- COPY packages ./packages
89
-
90
- RUN \
91
- # If you want to build docker in China, build with --build-arg USE_CN_MIRROR=true
92
- if [ "${USE_CN_MIRROR:-false}" = "true" ]; then \
93
- export SENTRYCLI_CDNURL="https://npmmirror.com/mirrors/sentry-cli"; \
94
- npm config set registry "https://registry.npmmirror.com/"; \
95
- echo 'canvas_binary_host_mirror=https://npmmirror.com/mirrors/canvas' >> .npmrc; \
96
- fi \
97
- # Set the registry for corepack
98
- && export COREPACK_NPM_REGISTRY=$(npm config get registry | sed 's/\/$//') \
99
- # Update corepack to latest (nodejs/corepack#612)
100
- && npm i -g corepack@latest \
101
- # Enable corepack
102
- && corepack enable \
103
- # Use pnpm for corepack
104
- && corepack use $(sed -n 's/.*"packageManager": "\(.*\)".*/\1/p' package.json) \
105
- # Install the dependencies
106
- && pnpm i \
107
- # Add db migration dependencies
108
- && mkdir -p /deps \
109
- && cd /deps \
110
- && pnpm init \
111
- && pnpm add pg drizzle-orm
112
-
113
- COPY . .
114
-
115
- # run build standalone for docker version
116
- RUN npm run build:docker
117
-
118
- ## Application image, copy all the files for production
119
- FROM busybox:latest AS app
120
-
121
- COPY --from=base /distroless/ /
122
-
123
- # Automatically leverage output traces to reduce image size
124
- # https://nextjs.org/docs/advanced-features/output-file-tracing
125
- COPY --from=builder /app/.next/standalone /app/
126
-
127
- # Copy database migrations
128
- COPY --from=builder /app/packages/database/migrations /app/migrations
129
- COPY --from=builder /app/scripts/migrateServerDB/docker.cjs /app/docker.cjs
130
- COPY --from=builder /app/scripts/migrateServerDB/errorHint.js /app/errorHint.js
131
-
132
- # copy dependencies
133
- COPY --from=builder /deps/node_modules/.pnpm /app/node_modules/.pnpm
134
- COPY --from=builder /deps/node_modules/pg /app/node_modules/pg
135
- COPY --from=builder /deps/node_modules/drizzle-orm /app/node_modules/drizzle-orm
136
-
137
- # Copy server launcher
138
- COPY --from=builder /app/scripts/serverLauncher/startServer.js /app/startServer.js
139
-
140
- RUN \
141
- # Add nextjs:nodejs to run the app
142
- addgroup -S -g 1001 nodejs \
143
- && adduser -D -G nodejs -H -S -h /app -u 1001 nextjs \
144
- # Set permission for nextjs:nodejs
145
- && chown -R nextjs:nodejs /app /etc/proxychains4.conf
146
-
147
- ## Production image, copy all the files and run next
148
- FROM scratch
149
-
150
- # Copy all the files from app, set the correct permission for prerender cache
151
- COPY --from=app / /
152
-
153
- ENV NODE_ENV="production" \
154
- NODE_OPTIONS="--dns-result-order=ipv4first --use-openssl-ca" \
155
- NODE_EXTRA_CA_CERTS="" \
156
- NODE_TLS_REJECT_UNAUTHORIZED="" \
157
- SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
158
-
159
- # Make the middleware rewrite through local as default
160
- # refs: https://github.com/lobehub/lobe-chat/issues/5876
161
- ENV MIDDLEWARE_REWRITE_THROUGH_LOCAL="1"
162
-
163
- # set hostname to localhost
164
- ENV HOSTNAME="0.0.0.0" \
165
- PORT="3210"
166
-
167
- # General Variables
168
- ENV ACCESS_CODE="" \
169
- APP_URL="" \
170
- API_KEY_SELECT_MODE="" \
171
- DEFAULT_AGENT_CONFIG="" \
172
- SYSTEM_AGENT="" \
173
- FEATURE_FLAGS="" \
174
- PROXY_URL="" \
175
- ENABLE_AUTH_PROTECTION=""
176
-
177
- # Database
178
- ENV KEY_VAULTS_SECRET="" \
179
- DATABASE_DRIVER="node" \
180
- DATABASE_URL=""
181
-
182
- # Next Auth
183
- ENV NEXT_AUTH_SECRET="" \
184
- NEXT_AUTH_SSO_PROVIDERS="" \
185
- NEXTAUTH_URL=""
186
-
187
- # Clerk
188
- ENV CLERK_SECRET_KEY="" \
189
- CLERK_WEBHOOK_SECRET=""
190
-
191
- # S3
192
- ENV NEXT_PUBLIC_S3_DOMAIN="" \
193
- S3_PUBLIC_DOMAIN="" \
194
- S3_ACCESS_KEY_ID="" \
195
- S3_BUCKET="" \
196
- S3_ENDPOINT="" \
197
- S3_SECRET_ACCESS_KEY="" \
198
- S3_ENABLE_PATH_STYLE="" \
199
- S3_SET_ACL=""
200
-
201
- # Model Variables
202
- ENV \
203
- # AI21
204
- AI21_API_KEY="" AI21_MODEL_LIST="" \
205
- # Ai360
206
- AI360_API_KEY="" AI360_MODEL_LIST="" \
207
- # AiHubMix
208
- AIHUBMIX_API_KEY="" AIHUBMIX_MODEL_LIST="" \
209
- # Anthropic
210
- ANTHROPIC_API_KEY="" ANTHROPIC_MODEL_LIST="" ANTHROPIC_PROXY_URL="" \
211
- # Amazon Bedrock
212
- ENABLED_AWS_BEDROCK="" AWS_ACCESS_KEY_ID="" AWS_SECRET_ACCESS_KEY="" AWS_REGION="" AWS_BEDROCK_MODEL_LIST="" \
213
- # Azure OpenAI
214
- AZURE_API_KEY="" AZURE_API_VERSION="" AZURE_ENDPOINT="" AZURE_MODEL_LIST="" \
215
- # Baichuan
216
- BAICHUAN_API_KEY="" BAICHUAN_MODEL_LIST="" \
217
- # Cloudflare
218
- CLOUDFLARE_API_KEY="" CLOUDFLARE_BASE_URL_OR_ACCOUNT_ID="" CLOUDFLARE_MODEL_LIST="" \
219
- # Cohere
220
- COHERE_API_KEY="" COHERE_MODEL_LIST="" COHERE_PROXY_URL="" \
221
- # ComfyUI
222
- ENABLED_COMFYUI="" COMFYUI_BASE_URL="" COMFYUI_AUTH_TYPE="" \
223
- COMFYUI_API_KEY="" COMFYUI_USERNAME="" COMFYUI_PASSWORD="" COMFYUI_CUSTOM_HEADERS="" \
224
- # DeepSeek
225
- DEEPSEEK_API_KEY="" DEEPSEEK_MODEL_LIST="" \
226
- # Fireworks AI
227
- FIREWORKSAI_API_KEY="" FIREWORKSAI_MODEL_LIST="" \
228
- # Gitee AI
229
- GITEE_AI_API_KEY="" GITEE_AI_MODEL_LIST="" \
230
- # GitHub
231
- GITHUB_TOKEN="" GITHUB_MODEL_LIST="" \
232
- # Google
233
- GOOGLE_API_KEY="" GOOGLE_MODEL_LIST="" GOOGLE_PROXY_URL="" \
234
- # Groq
235
- GROQ_API_KEY="" GROQ_MODEL_LIST="" GROQ_PROXY_URL="" \
236
- # Higress
237
- HIGRESS_API_KEY="" HIGRESS_MODEL_LIST="" HIGRESS_PROXY_URL="" \
238
- # HuggingFace
239
- HUGGINGFACE_API_KEY="" HUGGINGFACE_MODEL_LIST="" HUGGINGFACE_PROXY_URL="" \
240
- # Hunyuan
241
- HUNYUAN_API_KEY="" HUNYUAN_MODEL_LIST="" \
242
- # InternLM
243
- INTERNLM_API_KEY="" INTERNLM_MODEL_LIST="" \
244
- # Jina
245
- JINA_API_KEY="" JINA_MODEL_LIST="" JINA_PROXY_URL="" \
246
- # Minimax
247
- MINIMAX_API_KEY="" MINIMAX_MODEL_LIST="" \
248
- # Mistral
249
- MISTRAL_API_KEY="" MISTRAL_MODEL_LIST="" \
250
- # ModelScope
251
- MODELSCOPE_API_KEY="" MODELSCOPE_MODEL_LIST="" MODELSCOPE_PROXY_URL="" \
252
- # Moonshot
253
- MOONSHOT_API_KEY="" MOONSHOT_MODEL_LIST="" MOONSHOT_PROXY_URL="" \
254
- # Nebius
255
- NEBIUS_API_KEY="" NEBIUS_MODEL_LIST="" NEBIUS_PROXY_URL="" \
256
- # NewAPI
257
- NEWAPI_API_KEY="" NEWAPI_PROXY_URL="" \
258
- # Novita
259
- NOVITA_API_KEY="" NOVITA_MODEL_LIST="" \
260
- # Nvidia NIM
261
- NVIDIA_API_KEY="" NVIDIA_MODEL_LIST="" NVIDIA_PROXY_URL="" \
262
- # Ollama
263
- ENABLED_OLLAMA="" OLLAMA_MODEL_LIST="" OLLAMA_PROXY_URL="" \
264
- # OpenAI
265
- ENABLED_OPENAI="" OPENAI_API_KEY="" OPENAI_MODEL_LIST="" OPENAI_PROXY_URL="" \
266
- # OpenRouter
267
- OPENROUTER_API_KEY="" OPENROUTER_MODEL_LIST="" \
268
- # Perplexity
269
- PERPLEXITY_API_KEY="" PERPLEXITY_MODEL_LIST="" PERPLEXITY_PROXY_URL="" \
270
- # PPIO
271
- PPIO_API_KEY="" PPIO_MODEL_LIST="" \
272
- # Qiniu
273
- QINIU_API_KEY="" QINIU_MODEL_LIST="" QINIU_PROXY_URL="" \
274
- # Qwen
275
- QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \
276
- # SambaNova
277
- SAMBANOVA_API_KEY="" SAMBANOVA_MODEL_LIST="" \
278
- # Search1API
279
- SEARCH1API_API_KEY="" SEARCH1API_MODEL_LIST="" \
280
- # SenseNova
281
- SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \
282
- # SiliconCloud
283
- SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
284
- # Spark
285
- SPARK_API_KEY="" SPARK_MODEL_LIST="" SPARK_PROXY_URL="" SPARK_SEARCH_MODE="" \
286
- # Stepfun
287
- STEPFUN_API_KEY="" STEPFUN_MODEL_LIST="" \
288
- # Taichu
289
- TAICHU_API_KEY="" TAICHU_MODEL_LIST="" \
290
- # TogetherAI
291
- TOGETHERAI_API_KEY="" TOGETHERAI_MODEL_LIST="" \
292
- # Upstage
293
- UPSTAGE_API_KEY="" UPSTAGE_MODEL_LIST="" \
294
- # v0 (Vercel)
295
- V0_API_KEY="" V0_MODEL_LIST="" \
296
- # vLLM
297
- VLLM_API_KEY="" VLLM_MODEL_LIST="" VLLM_PROXY_URL="" \
298
- # Wenxin
299
- WENXIN_API_KEY="" WENXIN_MODEL_LIST="" \
300
- # xAI
301
- XAI_API_KEY="" XAI_MODEL_LIST="" XAI_PROXY_URL="" \
302
- # Xinference
303
- XINFERENCE_API_KEY="" XINFERENCE_MODEL_LIST="" XINFERENCE_PROXY_URL="" \
304
- # 01.AI
305
- ZEROONE_API_KEY="" ZEROONE_MODEL_LIST="" \
306
- # Zhipu
307
- ZHIPU_API_KEY="" ZHIPU_MODEL_LIST="" \
308
- # Tencent Cloud
309
- TENCENT_CLOUD_API_KEY="" TENCENT_CLOUD_MODEL_LIST="" \
310
- # Infini-AI
311
- INFINIAI_API_KEY="" INFINIAI_MODEL_LIST="" \
312
- # 302.AI
313
- AI302_API_KEY="" AI302_MODEL_LIST="" \
314
- # FAL
315
- ENABLED_FAL="" FAL_API_KEY="" FAL_MODEL_LIST="" \
316
- # BFL
317
- BFL_API_KEY="" BFL_MODEL_LIST="" \
318
- # Vercel AI Gateway
319
- VERCELAIGATEWAY_API_KEY="" VERCELAIGATEWAY_MODEL_LIST="" \
320
- # Cerebras
321
- CEREBRAS_API_KEY="" CEREBRAS_MODEL_LIST=""
322
-
323
- USER nextjs
324
-
325
- EXPOSE 3210/tcp
326
-
327
- ENTRYPOINT ["/bin/node"]
328
-
329
- CMD ["/app/startServer.js"]
File without changes