Merge branch 'main' of github.com:maxkb-dev/maxkb
This commit is contained in:
commit
9e22cf4968
27
.github/workflows/build-and-push-python-pg.yml
vendored
27
.github/workflows/build-and-push-python-pg.yml
vendored
@ -2,11 +2,34 @@ name: build-and-push-python-pg
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
architecture:
|
||||||
|
description: 'Architecture'
|
||||||
|
required: true
|
||||||
|
default: 'linux/amd64'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
- linux/amd64,linux/arm64
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-python-pg-to-ghcr:
|
build-and-push-python-pg-to-ghcr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -15,7 +38,7 @@ jobs:
|
|||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=ghcr.io/maxkb-dev/python-pg
|
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
|
TAG_NAME=python3.11.8-pg15.3
|
||||||
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
|||||||
@ -2,6 +2,20 @@ name: build-and-push-vector-model
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
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:
|
jobs:
|
||||||
build-and-push-vector-model-to-ghcr:
|
build-and-push-vector-model-to-ghcr:
|
||||||
@ -29,8 +43,8 @@ jobs:
|
|||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=ghcr.io/maxkb-dev/vector-model
|
DOCKER_IMAGE=ghcr.io/maxkb-dev/vector-model
|
||||||
DOCKER_PLATFORMS=linux/amd64,linux/arm64
|
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
|
||||||
TAG_NAME=v1.0.0
|
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
||||||
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
echo ::set-output name=version::${TAG_NAME}
|
echo ::set-output name=version::${TAG_NAME}
|
||||||
|
|||||||
13
.github/workflows/build-and-push.yml
vendored
13
.github/workflows/build-and-push.yml
vendored
@ -7,6 +7,15 @@ on:
|
|||||||
description: 'Docker Image Tag'
|
description: 'Docker Image Tag'
|
||||||
default: 'v1.0.0'
|
default: 'v1.0.0'
|
||||||
required: true
|
required: true
|
||||||
|
architecture:
|
||||||
|
description: 'Architecture'
|
||||||
|
required: true
|
||||||
|
default: 'linux/amd64'
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
- linux/amd64,linux/arm64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-fit2cloud-registry:
|
build-and-push-fit2cloud-registry:
|
||||||
@ -34,7 +43,7 @@ jobs:
|
|||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb
|
DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb
|
||||||
DOCKER_PLATFORMS=linux/amd64
|
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
|
||||||
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
||||||
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
@ -90,7 +99,7 @@ jobs:
|
|||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE=ghcr.io/maxkb-dev/maxkb
|
DOCKER_IMAGE=ghcr.io/maxkb-dev/maxkb
|
||||||
DOCKER_PLATFORMS=linux/amd64
|
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
|
||||||
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
||||||
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
|||||||
@ -10,10 +10,11 @@ RUN cd ui && \
|
|||||||
FROM ghcr.io/maxkb-dev/python-pg:python3.11.8-pg15.3
|
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
|
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model && mkdir -p /opt/maxkb/conf
|
||||||
VOLUME /opt/maxkb
|
|
||||||
# 拷贝项目
|
# 拷贝项目
|
||||||
COPY . /opt/maxkb/app
|
COPY . /opt/maxkb/app
|
||||||
COPY installer/config.yaml /opt/maxkb/conf
|
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
|
RUN rm -rf /opt/maxkb/app/ui /opt/maxkb/app/build
|
||||||
COPY --from=vector-model model /opt/maxkb/app/model
|
COPY --from=vector-model model /opt/maxkb/app/model
|
||||||
COPY --from=web-build ui /opt/maxkb/app/ui
|
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依赖
|
# 下载python依赖
|
||||||
RUN pip3 install --no-cache-dir -r requirements.txt
|
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||||
# 启动命令
|
# 启动命令
|
||||||
|
VOLUME /opt/maxkb/conf
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
COPY installer/run-maxkb.sh /usr/bin/
|
COPY installer/run-maxkb.sh /usr/bin/
|
||||||
RUN chmod 755 /usr/bin/run-maxkb.sh
|
RUN chmod 755 /usr/bin/run-maxkb.sh
|
||||||
|
|||||||
@ -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
|
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
|
# ensure local python is preferred over distribution python
|
||||||
ENV PATH /usr/local/bin:$PATH
|
ENV PATH /usr/local/bin:$PATH
|
||||||
|
|
||||||
@ -155,7 +152,7 @@ RUN set -eux; \
|
|||||||
\
|
\
|
||||||
savedAptMark="$(apt-mark showmanual)"; \
|
savedAptMark="$(apt-mark showmanual)"; \
|
||||||
apt-get update; \
|
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"; \
|
wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \
|
||||||
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \
|
echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Start postgress
|
# Start postgress
|
||||||
docker-entrypoint.sh postgres &
|
docker-entrypoint.sh postgres &
|
||||||
|
sleep 10
|
||||||
# Wait postgress
|
# Wait postgress
|
||||||
until pg_isready --host=127.0.0.1; do sleep 1 && echo "waiting for postgres"; done
|
until pg_isready --host=127.0.0.1; do sleep 1 && echo "waiting for postgres"; done
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user