From 993cbfe2cf18a6ebaaabe1fe8800837c1c1b72ff Mon Sep 17 00:00:00 2001 From: yuehuazhang Date: Fri, 26 Jul 2024 09:52:02 +0800 Subject: [PATCH] feat:docker --- .github/workflows/docker-build.yaml | 4 +- docker/.dockerignore | 28 ++---- .../Image Build \357\274\206 YAML Setup.md" | 29 ------ docker/langchain_sample.yaml | 91 ------------------- 4 files changed, 11 insertions(+), 141 deletions(-) delete mode 100644 "docker/Image Build \357\274\206 YAML Setup.md" delete mode 100644 docker/langchain_sample.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index e39d347827..272dc32bb0 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -122,8 +122,8 @@ jobs: file: ./docker/Dockerfile push: true tags: | - chatimage/chatchat:${{ steps.imageTag.outputs.image_tag }} - ccr.ccs.tencentyun.com/langchain-chatchat/chatchat:${{ steps.imageTag.outputs.image_tag }} + chatimage/chatchat:${{ env.image_tag }} + ccr.ccs.tencentyun.com/langchain-chatchat/chatchat:${{ env.image_tag }} platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64 - name: Logout from Docker Hub diff --git a/docker/.dockerignore b/docker/.dockerignore index a92645fafe..8c606241f2 100644 --- a/docker/.dockerignore +++ b/docker/.dockerignore @@ -1,23 +1,13 @@ -.idea -# Langchain-Chatchat -docs -.github -tests +.idea/ +.github/ Dockerfile .dockerignore -.gitignore -.gitmodules -README.md -README_en.md -README_ja.md -LICENSE -requirements_api.txt -requirements_lite.txt -requirements_webui.txt -# bge-large-zh-v1.5 -bge-large-zh-v1.5/README.md -# chatglm3-6b -../docs/contributing/ -../docs/install/ +../.gitignore +../.gitmodules +../LICENSE +../poetry.lock +../poetry.toml +../pyproject.toml +../docs/ ../README.md ../README_en.md \ No newline at end of file diff --git "a/docker/Image Build \357\274\206 YAML Setup.md" "b/docker/Image Build \357\274\206 YAML Setup.md" deleted file mode 100644 index e21d08dd55..0000000000 --- "a/docker/Image Build \357\274\206 YAML Setup.md" +++ /dev/null @@ -1,29 +0,0 @@ -# 创建代码根目录 -mkdir /home/langchain - -## 切换代码根目录 -cd /home/langchain - -## 拉取仓库代码 -git clone https://github.com/chatchat-space/Langchain-Chatchat.git . - -## 切换Configs文件夹,复制所有的配置档并去除文档后缀.example -/home/langchain/configs/ - -## 配置key -/home/langchain/configs/model_config.py - -## 切换代码根目录 -cd /home/langchain - -## 制作镜像(自行修改镜像名称与版本号) -docker build -t {image_name}:{image_tag} . - -## 修改YAML里的镜像名称与版本号 -langchain_sample.yaml - -## 创建K8S资源 -kubectl apply -f langchain_sample.yaml - -## 删除K8S资源 -kubectl delete -f langchain_sample.yaml diff --git a/docker/langchain_sample.yaml b/docker/langchain_sample.yaml deleted file mode 100644 index 7d543cd5b9..0000000000 --- a/docker/langchain_sample.yaml +++ /dev/null @@ -1,91 +0,0 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: langchain-pv -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Retain - storageClassName: standard - local: - path: /home/langchain #填入代码所在的目录 - nodeAffinity: - required: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/hostname - operator: In - values: - - instance-1 ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: langchain-pvc -spec: - accessModes: - - ReadWriteMany - storageClassName: standard - resources: - requests: - storage: 10Gi - volumeName: langchain-pv ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: langchain -spec: - replicas: 1 - selector: - matchLabels: - app: langchain - template: - metadata: - labels: - app: langchain - spec: - securityContext: - fsGroup: 101 - containers: - - name: langchain - image:{image_name}:{image_tag} #填入镜像名称与版本号 - command: ["python"] - args: ["startup.py","-a"] #启动命令 - ports: - - containerPort: 8501 - - containerPort: 7861 - - containerPort: 20000 - volumeMounts: - - name: langchain-vol - mountPath: /Langchain-Chatchat - nodeSelector: - kubernetes.io/hostname: instance-1 - volumes: - - name: langchain-vol - persistentVolumeClaim: - claimName: langchain-pvc ---- -apiVersion: v1 -kind: Service -metadata: - name: langchain-service -spec: - selector: - app: langchain - type: NodePort - ports: - - name: webui - port: 8501 - targetPort: 8501 - nodePort: 8501 - - name: api - port: 7861 - targetPort: 7861 - nodePort: 7861 - - name: fastchat - port: 20000 - targetPort: 20000 - nodePort: 20000 \ No newline at end of file