Repository navigation
135 lines (125 loc) · 6.09 KB
/
Copy pathdocker-deploy.yml
File metadata and controls
135 lines (125 loc) · 6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Deploy Nexent Community
on:
workflow_dispatch:
inputs:
deployment_mode:
description: 'Deployment mode: development or production'
required: true
default: 'development'
type: choice
options:
- development
- production
runner_label_json:
description: 'runner array in json format (e.g. ["ubuntu-latest"] or ["self-hosted"])'
required: true
default: '[]'
app_version:
description: 'Docker image tag to build and deploy (e.g. v1.7.1)'
required: true
default: 'latest'
type: string
build_full_sandbox:
description: 'Also build the optional full sandbox image'
required: true
default: false
type: boolean
jobs:
build-main:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build main application image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent:${{ github.event.inputs.app_version }} -t nexent/nexent -f deploy/images/dockerfiles/main/Dockerfile .
build-data-process:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if model is cached locally
id: check-model
run: |
if [ -f ~/model-assets/clip-vit-base-patch32/config.json ] && \
[ -d ~/model-assets/nltk_data ] && \
[ -d ~/model-assets/table-transformer-structure-recognition ] && \
[ -d ~/model-assets/yolox ]; then
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
cp -r ~/model-assets ./
else
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
fi
- name: Clone model if not cached
if: steps.check-model.outputs.cache-hit == 'false'
run: |
GIT_LFS_SKIP_SMUDGE=1 git clone https://hf-mirror.com/Nexent-AI/model-assets
cd ./model-assets
GIT_TRACE=1 GIT_CURL_VERBOSE=1 GIT_LFS_LOG=debug git lfs pull
rm -rf .git .gitattributes
- name: Build data process image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent-data-process:${{ github.event.inputs.app_version }} -t nexent/nexent-data-process -f deploy/images/dockerfiles/data-process/Dockerfile .
build-web:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build web frontend image
run: docker build --build-arg MIRROR=https://registry.npmmirror.com --build-arg APK_MIRROR=tsinghua -t nexent/nexent-web:${{ github.event.inputs.app_version }} -t nexent/nexent-web -f deploy/images/dockerfiles/web/Dockerfile .
build-docs:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build docs image
run: docker build --progress=plain -t nexent/nexent-docs:${{ github.event.inputs.app_version }} -t nexent/nexent-docs -f deploy/images/dockerfiles/docs/Dockerfile .
build-sandbox:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build sandbox image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent-sandbox:${{ github.event.inputs.app_version }} -t nexent/nexent-sandbox -f deploy/images/dockerfiles/sandbox/Dockerfile .
- name: Build optional full sandbox image
if: ${{ inputs.build_full_sandbox }}
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent-sandbox-full:${{ github.event.inputs.app_version }} -t nexent/nexent-sandbox-full -f deploy/images/dockerfiles/sandbox-full/Dockerfile .
build-mcp:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build MCP image
run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --build-arg APT_MIRROR=tsinghua -t nexent/nexent-mcp:${{ github.event.inputs.app_version }} -t nexent/nexent-mcp -f deploy/images/dockerfiles/mcp/Dockerfile .
deploy:
runs-on: ${{ fromJson(inputs.runner_label_json) }}
needs: [ build-main, build-data-process, build-web, build-docs, build-sandbox, build-mcp ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Copy project to $HOME/nexent
run: |
rm -rf $HOME/nexent
mkdir -p $HOME/nexent
cp -r $GITHUB_WORKSPACE/* $HOME/nexent/
- name: Force APP_VERSION to latest in deploy.sh (CI only)
run: |
sed -i 's/APP_VERSION="$(get_app_version)"/APP_VERSION="${{ github.event.inputs.app_version }}"/' $HOME/nexent/deploy/docker/deploy.sh
- name: Start docs container
run: |
docker stop nexent-docs 2>/dev/null || true
docker rm nexent-docs 2>/dev/null || true
docker run -d --name nexent-docs -p 4173:4173 nexent/nexent-docs
- name: Ensure deploy.sh is executable
run: chmod +x $HOME/nexent/deploy.sh $HOME/nexent/deploy/docker/deploy.sh
- name: Deploy with deploy.sh
env:
DEPLOYMENT_MODE: ${{ github.event.inputs.deployment_mode }}
run: |
cd $HOME/nexent
cp deploy/env/.env.example deploy/env/.env
sed -i "s/APPID=.*/APPID=${{ secrets.VOICE_APPID }}/" deploy/env/.env
sed -i "s/TOKEN=.*/TOKEN=${{ secrets.VOICE_TOKEN }}/" deploy/env/.env
if [ "$DEPLOYMENT_MODE" = "production" ]; then
./deploy.sh docker --mode 3 --is-mainland N --enable-terminal N --version 2 --root-dir "$HOME/nexent-production-data"
else
./deploy.sh docker --mode 1 --is-mainland N --enable-terminal N --version 2 --root-dir "$HOME/nexent-development-data"
fi