build: 分开镜像
This commit is contained in:
parent
b50689f529
commit
a935021f13
@ -1,2 +1 @@
|
|||||||
.git*
|
.git*
|
||||||
ui
|
|
||||||
71
.github/workflows/build-and-push.yml
vendored
71
.github/workflows/build-and-push.yml
vendored
@ -16,9 +16,19 @@ on:
|
|||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64
|
- linux/arm64
|
||||||
- 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:
|
jobs:
|
||||||
build-and-push:
|
build-and-push-to-fit2cloud-registry:
|
||||||
|
if: contains(${{ github.event.inputs.registry }}, 'fit2cloud')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check Disk Space
|
- name: Check Disk Space
|
||||||
@ -42,12 +52,14 @@ jobs:
|
|||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prepare
|
id: prepare
|
||||||
run: |
|
run: |
|
||||||
DOCKER_IMAGE_FIT2CLOUD=registry-hkproxy.fit2cloud.com/maxkb/maxkb
|
DOCKER_IMAGE=registry-hkproxy.fit2cloud.com/maxkb/maxkb
|
||||||
DOCKER_IMAGE_DOCKERHUB=1panel/maxkb
|
|
||||||
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
|
DOCKER_PLATFORMS=${{ github.event.inputs.architecture }}
|
||||||
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
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"
|
if [[ TAG_NAME == *dev* ]]; then
|
||||||
echo ::set-output name=version::${TAG_NAME}
|
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 \
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} --no-cache \
|
||||||
${DOCKER_IMAGE_TAGS} .
|
${DOCKER_IMAGE_TAGS} .
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
@ -66,6 +78,55 @@ jobs:
|
|||||||
registry: registry-hkproxy.fit2cloud.com
|
registry: registry-hkproxy.fit2cloud.com
|
||||||
username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }}
|
username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }}
|
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
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
@ -8,17 +8,17 @@ RUN cd ui && \
|
|||||||
|
|
||||||
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
|
FROM ghcr.io/1panel-dev/maxkb-python-pg:python3.11.8-pg15.3
|
||||||
# 创建工作目录
|
# 创建工作目录
|
||||||
RUN mkdir -p /opt/maxkb/app && /opt/maxkb/app/ui && 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
|
||||||
# 拷贝项目
|
# 拷贝项目
|
||||||
COPY . /opt/maxkb/app
|
COPY . /opt/maxkb/app
|
||||||
|
RUN rm -rf /opt/maxkb/app/ui/*
|
||||||
COPY installer/config.yaml /opt/maxkb/conf
|
COPY installer/config.yaml /opt/maxkb/conf
|
||||||
COPY --from=vector-model model /opt/maxkb/app/model
|
COPY --from=vector-model model /opt/maxkb/app/model
|
||||||
COPY --from=web-build ui/dist /opt/maxkb/app/ui
|
COPY --from=web-build ui/dist /opt/maxkb/app/ui
|
||||||
ENV POSTGRES_USER root
|
ENV POSTGRES_USER root
|
||||||
ENV POSTGRES_PASSWORD Password123@postgres
|
ENV POSTGRES_PASSWORD Password123@postgres
|
||||||
WORKDIR /opt/maxkb/app
|
WORKDIR /opt/maxkb/app
|
||||||
RUN rm -rf /opt/maxkb/app/build && \
|
RUN mv /opt/maxkb/app/model/* /opt/maxkb/model && \
|
||||||
mv /opt/maxkb/app/model/* /opt/maxkb/model && \
|
|
||||||
cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \
|
cp -r /opt/maxkb/model/base/hub /opt/maxkb/model/tokenizer && \
|
||||||
apt-get update && apt-get install -y curl && \
|
apt-get update && apt-get install -y curl && \
|
||||||
pip3 install --upgrade pip && \
|
pip3 install --upgrade pip && \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user