Skip to content

Commit

Permalink
Merge branch 'feat/0.3.1.5' into feat/rag_optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jun 26, 2024
2 parents 588bc0a + 1e97e49 commit 9316b1b
Show file tree
Hide file tree
Showing 259 changed files with 14,749 additions and 5,267 deletions.
180 changes: 155 additions & 25 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,171 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
name: cicd # 定义流水线名称

clone:
disable: true

steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: clone
image: alpine/git
pull: if-not-exists
environment:
http_proxy:
from_secret: PROXY
https_proxy:
from_secret: PROXY
commands:
- git clone https://github.com/dataelement/bisheng.git .
- git checkout $DRONE_COMMIT

- name: package # 流水线名称
pull: if-not-exists
image: python:3.10-slim # 定义创建容器的Docker镜像
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
- name: maven-cache
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
- name: maven-build
- name: bisheng-cache
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
environment:
RELEASE_VERSION: 99.99.99
NEXUS_USER:
from_secret: NEXUS_USER
NEXUS_PASSWORD:
from_secret: NEXUS_PASSWORD
REPO:
from_secret: PY_NEXUS
commands: # 定义在Docker容器中执行的shell命令
- pip install Cython
- pip install wheel
- pip install twine
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- cd ./src/bisheng-langchain
- python setup.py bdist_wheel
- cp dist.* /app/build/

- name: build_backend
image: python:3.10-slim # 定义创建容器的Docker镜像
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
- name: maven-cache
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
- name: maven-build
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
- twine upload --verbose -u $NEXUS_USER -p $NEXUS_PASSWORD --repository-url $REPO dist/*.whl

- name: set poetry
pull: if-not-exists
image: golang
environment:
RELEASE_VERSION: 99.99.99
NEXUS_PUBLIC:
from_secret: NEXUS_PUBLIC
NEXUS_PUBLIC_PASSWORD:
from_secret: NEXUS_PUBLIC_PASSWORD
REPO:
from_secret: PY_NEXUS
PROXY:
from_secret: APT-GET
commands:
- cd ./src/backend
- pip install bisheng_langchain==$RELEASE_VERSION
- sed -i 's/^bisheng_langchain.*/bisheng_langchain = "'$RELEASE_VERSION'"/g' pyproject.toml
- poetry lock
- cd ./src/backend/
- echo $REPO
- REPO2=$(echo $REPO | sed 's/http:\\/\\///g')
- sed '/apt-get/ s|$| '"$PROXY"'|' Dockerfile
- sed -i 's/^bisheng_langchain.*/bisheng_langchain = "'$RELEASE_VERSION'"/g' pyproject.toml
- sed -i '6i\RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- sed -i '23i\RUN poetry source add --priority=supplemental foo http://'$NEXUS_PUBLIC':'$NEXUS_PUBLIC_PASSWORD'@'$REPO2'simple' Dockerfile
- sed -i '23i\RUN poetry source add --priority=primary qh https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- cat Dockerfile

- name: build_docker
pull: if-not-exists
image: plugins/docker
privileged: true
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
- name: apt-cache
path: /var/cache/apt/archives # 将应用打包好的Jar和执行脚本挂载出来
- name: socket
path: /var/run/docker.sock
settings:
registry: http://192.168.106.8:6082
insecure: true
purge: true
repo: 192.168.106.8:6082/dataelement/bisheng-backend
tags: [ release ]
context: ./src/backend/
dockerfile: ./src/backend/Dockerfile
username:
from_secret: NEXUS_USER
password:
from_secret: NEXUS_PASSWORD
- name: build_docker_frontend
pull: if-not-exists
image: plugins/docker
privileged: true
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
- name: apt-cache
path: /var/cache/apt/archives # 将应用打包好的Jar和执行脚本挂载出来
- name: socket
path: /var/run/docker.sock
settings:
registry: http://192.168.106.8:6082
insecure: true
purge: true
repo: 192.168.106.8:6082/dataelement/bisheng-frontend
tags: [ release ]
context: ./src/frontend/
dockerfile: ./src/frontend/Dockerfile
username:
from_secret: NEXUS_USER
password:
from_secret: NEXUS_PASSWORD

- name: ssh deploy
image: appleboy/drone-ssh
pull: if-not-exists
settings:
host: 192.168.106.116
username: root
password:
from_secret: sshpwd
script:
- echo =======找到目录=======
- cd /opt/server/bisheng-test
- echo =======直接启动=======
- docker compose pull
- docker compose up -d

- name: build-image # 步骤名称
image: plugins/docker # 使用镜像
settings: # 当前设置
username: # 账号名称
from_secret: docker_username
password: # 账号密码
from_secret: docker_password
dockerfile: deploy/Dockerfile # Dockerfile地址, 注意是相对地址
repo: yxs970707/deploy-web-demo # 镜像名称
- name: notify-start # notify
pull: if-not-exists
image: plugins/webhook
settings:
debug: true
urls:
from_secret: FEISHU_URL
content_type: application/json
template: |
{
"msg_type": "interactive",
"card": {
"type": "template",
"data": {
"template_id": "AAqkI9bnY5FUs",
"template_variable": {
"repo_name": "{{ repo.name }}",
"build_branch": "{{build.branch}}",
"build_author": "{{ DRONE_COMMIT_AUTHOR }}",
"link": "{{build.link}}",
"commit_msg": "{{ trim build.message }}",
"build_tag":"{{build.tag}}",
"build_start":"{{build.started}}",
"status": "{{ build.status }}"
}
}
}
}
when: # 成功
status:
- success
trigger:
branch:
- release
event:
- push

volumes:
- name: bisheng-cache
host:
path: /opt/drone/data/bisheng/
- name: apt-cache
host:
path: /opt/drone/data/bisheng/apt/
- name: socket
host:
path: /var/run/docker.sock
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ jobs:
# DOCKERHUB_TOKEN: docker hub => Account Setting => Security 创建.
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# - name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# registry: https://cr.dataelem.com/
# username: ${{ secrets.CR_DOCKERHUB_USERNAME }}
# password: ${{ secrets.CR_DOCKERHUB_TOKEN }}

# 构建 backend 并推送到 Docker hub
- name: Set up QEMU
Expand Down
Loading

0 comments on commit 9316b1b

Please sign in to comment.