Skip to content

Dev #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 5, 2024
Merged

Dev #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: docker-build
on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'README_en.md'
- 'docs/**'
- '.github/actions/**'
- '.github/ISSUE_TEMPLATE/**'
- 'docker/docker-compose.yaml'
pull_request:
branches:
- master
types:
- closed
paths-ignore:
- 'README.md'
- 'README_en.md'
- 'docs/**'
- '.github/actions/**'
- '.github/ISSUE_TEMPLATE/**'
- 'docker/docker-compose.yaml'
env:
TZ: Asia/Shanghai
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Optimize Disk Space
uses: hugoalh/[email protected]
with:
operate_sudo: "True"
general_include: ".+"
general_exclude: |-
^GCC$
^G\+\+$
Clang
LLVM
docker_include: ".+"
docker_prune: "True"
docker_clean: "True"
apt_prune: "True"
apt_clean: "True"
homebrew_prune: "True"
homebrew_clean: "True"
npm_prune: "True"
npm_clean: "True"
os_swap: "True"
- name: Remove Unnecessary Tools And Files
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get remove -y '^dotnet-.*' '^llvm-.*' 'php.*' azure-cli google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove --purge -y
sudo find /var/log -name "*.gz" -type f -delete
sudo rm -rf /var/cache/apt/archives
sudo rm -rf /tmp/*
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php
sudo -E apt-get -y purge azure-cli* docker* ghc* zulu* hhvm* llvm* firefox* google* dotnet* aspnetcore* powershell* openjdk* adoptopenjdk* mysql* php* mongodb* moby* snap* || true
sudo rm -rf /etc/apt/sources.list.d/* /usr/local/lib/android /opt/ghc /usr/share/dotnet /usr/local/graalvm /usr/local/.ghcup \
/usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/node_modules
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php
sudo -E apt-get -y purge azure-cli* docker* ghc* zulu* hhvm* llvm* firefox* google* dotnet* aspnetcore* powershell* openjdk* adoptopenjdk* mysql* php* mongodb* moby* snap* || true
sudo -E apt-get -qq update
sudo -E apt-get -qq install libfuse-dev $(curl -fsSL git.io/depends-ubuntu-2204)
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo apt-get clean
rm -rf /opt/hostedtoolcache
sudo timedatectl set-timezone "$TZ"
- name: Free Up Disk Space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 20480 # 给 / 预留 20GiB 空间( docker 预留)
swap-size-mb: 1
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Version
id: version
run: |
VERSION=$(awk -F'"' '/__version__ =/ {print $2}' libs/chatchat-server/chatchat/__init__.py)
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Set DockerImage Tag
id: imageTag
run: echo "image_tag=${RELEASE_VERSION}-$(git rev-parse --short HEAD)-$(date +%Y%m%d)" >> $GITHUB_ENV
- name: Set Up QEMU
uses: docker/setup-qemu-action@v2
- name: Set Up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login To Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
- name: Login To Tencent CCR
uses: docker/login-action@v2
with:
registry: ccr.ccs.tencentyun.com
username: ${{ secrets.CCR_REGISTRY_USERNAME }}
password: ${{ secrets.CCR_REGISTRY_PASSWORD }}
- name: Show Runner Disk
run: df -hT
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ./docker
file: ./docker/Dockerfile
push: true
tags: |
chatimage/keng:${{ env.image_tag }}
ccr.ccs.tencentyun.com/langchain-chatchat/keng:${{ env.image_tag }}
platforms: |
linux/amd64, linux/arm64
- name: Logout from Docker Hub
run: docker logout
- name: Logout from Tencent Cloud Container Registry
run: docker logout ccr.ccs.tencentyun.com
- name: Update Doc and Create Pull Request
run: |
# 更新文件内容
sed -i -E "s|chatimage/chatchat:[a-zA-Z0-9._-]+|chatimage/keng:${{ env.image_tag }}|g" README.md README_en.md docker/docker-compose.yaml
sed -i -E "s|ccr.ccs.tencentyun.com/langchain-chatchat/keng:[a-zA-Z0-9._-]+|ccr.ccs.tencentyun.com/langchain-chatchat/keng:${{ env.image_tag }}|g" README.md README_en.md docker/docker-compose.yaml
# 配置 Git 用户信息
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# 创建新的分支
git checkout -b update-docker-image-${{ env.image_tag }}
# 提交更改
git commit -am "feat: update docker image to ${{ env.image_tag }}"
# 推送到新的分支
git push origin update-docker-image-${{ env.image_tag }}
# 安装 hub 命令行工具
wget -qO- https://github.com/github/hub/releases/download/v2.14.2/hub-linux-amd64-2.14.2.tgz | tar xvz
sudo ./hub-linux-amd64-2.14.2/install
# 使用 hub 命令行工具创建 PR
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
hub pull-request -b master -h update-docker-image-${{ env.image_tag }} -m "Update Docker image to ${{ env.image_tag }}" -l docker,automated-pr
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,23 +349,17 @@ docker pull ccr.ccs.tencentyun.com/langchain-chatchat/chatchat:0.3.1.3-93e2c87-2

🎉 Langchain-Chatchat 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。

### 公众号

<img src="docs/img/official_wechat_mp_account.png" alt="二维码" width="300" />

🎉 Langchain-Chatchat 项目官方公众号,欢迎扫码关注。

## 引用

如果本项目有帮助到您的研究,请引用我们:

```
@software{langchain_chatchat,
title = {{langchain-chatchat}},
author = {Liu, Qian and Song, Jinke, and Huang, Zhiguo, and Zhang, Yuxuan, and glide-the, and liunux4odoo},
@software{langchain-chatchat/keng,
title = {{langchain-chatchat/keng}},
author = {Liu, Qian and Zhang, Yuehua, and Song, Jinke, and Huang, Zhiguo, and Zhang, Yuxuan, and glide-the, and liunux4odoo},
year = 2024,
journal = {GitHub repository},
publisher = {GitHub},
howpublished = {\url{https://github.com/chatchat-space/Langchain-Chatchat}}
howpublished = {\url{https://github.com/chatchat-space/Keng}}
}
```
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 基础镜像
FROM python:3.11
LABEL maintainer=Langchain-Chatchat
FROM python:3.12
LABEL maintainer=yuehua-s
WORKDIR /root

# 环境变量
Expand All @@ -21,8 +21,8 @@ RUN pip install --index-url https://pypi.python.org/simple/ pipx && \
# Add poetry to PATH
ENV PATH="/root/.local/bin:${PATH}"

# 下载 Langchain-Chatchat
RUN git clone https://github.com/chatchat-space/Langchain-Chatchat.git
# 下载 Keng
RUN git clone https://github.com/chatchat-space/Keng.git

# 安装依赖
WORKDIR /root/Langchain-Chatchat/libs/chatchat-server
Expand Down
32 changes: 0 additions & 32 deletions docs/contributing/README.md

This file was deleted.

132 changes: 0 additions & 132 deletions docs/contributing/agent.md

This file was deleted.

Loading
Loading