Merge branch 'main' of github.com:1Panel-dev/MaxKB

This commit is contained in:
shaohuzhang1 2024-03-19 19:55:19 +08:00
commit e24f90fb00
4 changed files with 93 additions and 29 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git*

View File

@ -16,9 +16,19 @@ on:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
registry:
description: 'Push To Registry'
required: true
default: 'dockerhub, fit2cloud-registry'
type: choice
options:
- dockerhub
- fit2cloud-registry
- dockerhub, fit2cloud-registry
jobs:
build-and-push:
build-and-push-to-fit2cloud-registry:
if: contains(${{ github.event.inputs.registry }}, 'fit2cloud')
runs-on: ubuntu-latest
steps:
- name: Check Disk Space
@ -42,12 +52,14 @@ jobs:
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE_FIT2CLOUD=registry-hkproxy.fit2cloud.com/maxkb/maxkb
DOCKER_IMAGE_DOCKERHUB=1panel/maxkb
DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE_FIT2CLOUD}:${TAG_NAME} --tag ${DOCKER_IMAGE_FIT2CLOUD}:latest --tag ${DOCKER_IMAGE_DOCKERHUB}:${TAG_NAME} --tag ${DOCKER_IMAGE_DOCKERHUB}:latest"
echo ::set-output name=version::${TAG_NAME}
if [[ TAG_NAME == *dev* ]]; then
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}"
else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \
${DOCKER_IMAGE_TAGS} .
- name: Set up QEMU
@ -66,6 +78,55 @@ jobs:
registry: registry-hkproxy.fit2cloud.com
username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }}
password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }}
- name: Docker Buildx (build-and-push)
run: |
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile
build-and-push-to-dockerhub:
if: contains(${{ github.event.inputs.registry }}, 'dockerhub')
runs-on: ubuntu-latest
steps:
- name: Check Disk Space
run: df -h
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check Disk Space
run: df -h
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=1panel/maxkb
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
if [[ TAG_NAME == *dev* ]]; then
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME}"
else
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \
${DOCKER_IMAGE_TAGS} .
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:

View File

@ -23,13 +23,23 @@ docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb
也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + OllamaLlama 230 分钟内即可上线基于本地大模型的知识库问答系统。
## UI 展示
<table style="border-collapse: collapse; border: 1px solid black;">
<tr>
<td style="padding: 5px;background-color:#fff;"><img src= "https://github.com/1Panel-dev/MaxKB/assets/80892890/2b893a25-ae46-48da-b6a1-61d23015565e" alt="Demo1" /></td>
<td style="padding: 5px;background-color:#fff;"><img src= "https://github.com/1Panel-dev/MaxKB/assets/80892890/3e50e7ff-cdc4-4a37-b430-d84975f11d4e" alt="Demo2" /></td>
</tr>
<tr>
<td style="padding: 5px;background-color:#fff;"><img src= "https://github.com/1Panel-dev/MaxKB/assets/80892890/dfdcc03f-ef36-4f75-bb82-797c0f9da1ad" alt="Demo3" /></td>
<td style="padding: 5px;background-color:#fff;"><img src= "https://github.com/1Panel-dev/MaxKB/assets/80892890/884a9db1-3f93-4013-bc8f-a3f0dbcfeb2f" alt="Demo4" /></td>
</tr>
</table>
TBD
## 社区交流
## 微信交流群
[论坛](https://bbs.fit2cloud.com/c/mk/11)
TBD
## 技术栈

View File

@ -4,37 +4,29 @@ FROM node:18-alpine3.18 as web-build
COPY ui ui
RUN cd ui && \
npm install && \
npm run build && \
rm -rf ./node_modules
npm run build
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
# 创建工作目录
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
# 拷贝项目
COPY . /opt/maxkb/app
RUN rm -rf /opt/maxkb/app/ui/*
COPY installer/config.yaml /opt/maxkb/conf
COPY --from=vector-model model /opt/maxkb/app/model
COPY --from=web-build ui/dist /opt/maxkb/app/ui
ENV POSTGRES_USER root
ENV POSTGRES_PASSWORD Password123@postgres
RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build
COPY --from=vector-model model /opt/maxkb/app/model
COPY --from=web-build ui /opt/maxkb/app/ui
RUN ls -la /opt/maxkb/app
# 复制模型
RUN mv /opt/maxkb/app/model/* /opt/maxkb/model
RUN ls /opt/maxkb/model
RUN cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer
# 设置工作目录
WORKDIR /opt/maxkb/app
# 更新apt-get包管理器
RUN apt-get update&&apt-get install -y curl
# 更新pip
RUN pip3 install --upgrade pip
# 安装 poetry包管理器
RUN pip3 install poetry
# 导出依赖
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# 下载python依赖
RUN pip3 install --no-cache-dir -r requirements.txt
RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \
cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \
apt-get update && apt-get install -y curl && \
pip3 install --upgrade pip && \
pip3 install poetry && \
poetry export -f requirements.txt --output requirements.txt --without-hashes && \
pip3 install --no-cache-dir -r requirements.txt && \
pip3 cache purge && \
rm -rf /var/lib/apt/lists/*
# 启动命令
VOLUME /opt/maxkb/conf
EXPOSE 8000