Merge branch 'main' of github.com:maxkb-dev/maxkb

This commit is contained in:
shaohuzhang1 2024-03-18 15:34:40 +08:00
commit 9e22cf4968
6 changed files with 59 additions and 14 deletions

View File

@ -2,11 +2,34 @@ name: build-and-push-python-pg
on:
workflow_dispatch:
inputs:
architecture:
description: 'Architecture'
required: true
default: 'linux/amd64'
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
jobs:
build-and-push-python-pg-to-ghcr:
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:
@ -15,7 +38,7 @@ jobs:
id: prepare
run: |
DOCKER_IMAGE=ghcr.io/maxkb-dev/python-pg
DOCKER_PLATFORMS=linux/amd64
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=python3.11.8-pg15.3
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
echo ::set-output name=docker_image::${DOCKER_IMAGE}

View File

@ -2,6 +2,20 @@ name: build-and-push-vector-model
on:
workflow_dispatch:
inputs:
dockerImageTag:
description: 'Docker Image Tag'
default: 'v1.0.0'
required: true
architecture:
description: 'Architecture'
required: true
default: 'linux/amd64'
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
jobs:
build-and-push-vector-model-to-ghcr:
@ -29,8 +43,8 @@ jobs:
id: prepare
run: |
DOCKER_IMAGE=ghcr.io/maxkb-dev/vector-model
DOCKER_PLATFORMS=linux/amd64,linux/arm64
TAG_NAME=v1.0.0
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${TAG_NAME}

View File

@ -7,6 +7,15 @@ on:
description: 'Docker Image Tag'
default: 'v1.0.0'
required: true
architecture:
description: 'Architecture'
required: true
default: 'linux/amd64'
type: choice
options:
- linux/amd64
- linux/arm64
- linux/amd64,linux/arm64
jobs:
build-and-push-fit2cloud-registry:
@ -34,7 +43,7 @@ jobs:
id: prepare
run: |
DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb
DOCKER_PLATFORMS=linux/amd64
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
echo ::set-output name=docker_image::${DOCKER_IMAGE}
@ -90,7 +99,7 @@ jobs:
id: prepare
run: |
DOCKER_IMAGE=ghcr.io/maxkb-dev/maxkb
DOCKER_PLATFORMS=linux/amd64
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
echo ::set-output name=docker_image::${DOCKER_IMAGE}

View File

@ -10,10 +10,11 @@ RUN cd ui && \
FROM ghcr.io/maxkb-dev/python-pg:python3.11.8-pg15.3
# 创建工作目录
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
VOLUME /opt/maxkb
# 拷贝项目
COPY . /opt/maxkb/app
COPY installer/config.yaml /opt/maxkb/conf
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
@ -35,6 +36,7 @@ RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# 下载python依赖
RUN pip3 install --no-cache-dir -r requirements.txt
# 启动命令
VOLUME /opt/maxkb/conf
EXPOSE 8000
COPY installer/run-maxkb.sh /usr/bin/
RUN chmod 755 /usr/bin/run-maxkb.sh

View File

@ -10,12 +10,9 @@ COPY installer/init.sql /docker-entrypoint-initdb.d
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
ENV POSTGRES_USER root
# ---- install python --- #
# ---- below content is copied from https://github.com/docker-library/python/blob/master/3.11/slim-bullseye/Dockerfile --- #
ENV POSTGRES_PASSWORD Password123@postgres
# ---- prepare python env --- #
# ---- below content is copied https://github.com/docker-library/python/blob/master/3.11/slim-bullseye/Dockerfile --- #
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
@ -155,7 +152,7 @@ RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends wget; \
apt-get install -y --no-install-recommends wget vim; \
\
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \

View File

@ -2,7 +2,7 @@
# Start postgress
docker-entrypoint.sh postgres &
sleep 10
# Wait postgress
until pg_isready --host=127.0.0.1; do sleep 1 && echo "waiting for postgres"; done