diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..92c02acca --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git* \ No newline at end of file diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 7614f99bd..39e8d8ddd 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -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: diff --git a/README.md b/README.md index e74d7f148..78b6fcc0e 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,23 @@ docker run -d --name=maxkb -p 8000:8000 ghcr.io/1panel-dev/maxkb 也可以通过 [1Panel 应用商店](https://apps.fit2cloud.com/1panel) 快速部署 MaxKB + Ollama(Llama 2),30 分钟内即可上线基于本地大模型的知识库问答系统。 + ## UI 展示 +