mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-28 23:32:48 +00:00
build: update dockerfiles.
This commit is contained in:
parent
bb0ad0a27b
commit
996ebea316
|
|
@ -1,2 +1,3 @@
|
|||
.git*
|
||||
.idea*
|
||||
installer/
|
||||
|
|
@ -60,4 +60,4 @@ jobs:
|
|||
password: ${{ secrets.GH_TOKEN }}
|
||||
- name: Docker Buildx (build-and-push)
|
||||
run: |
|
||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile-python-pg
|
||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile-base
|
||||
|
|
@ -5,7 +5,7 @@ on:
|
|||
inputs:
|
||||
dockerImageTag:
|
||||
description: 'Docker Image Tag'
|
||||
default: 'v1.0.1'
|
||||
default: 'v2.0.0'
|
||||
required: true
|
||||
architecture:
|
||||
description: 'Architecture'
|
||||
|
|
@ -19,7 +19,7 @@ on:
|
|||
|
||||
jobs:
|
||||
build-and-push-vector-model-to-ghcr:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check Disk Space
|
||||
run: df -h
|
||||
|
|
@ -55,9 +55,6 @@ jobs:
|
|||
${DOCKER_IMAGE_TAGS} .
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
# Until https://github.com/tonistiigi/binfmt/issues/215
|
||||
image: tonistiigi/binfmt:qemu-v7.0.0-28
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to GitHub Container Registry
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
FROM ghcr.io/1panel-dev/maxkb-vector-model:v1.0.1 AS vector-model
|
||||
FROM ghcr.io/1panel-dev/maxkb-vector-model:v2.0.0 AS vector-model
|
||||
FROM node:18-alpine3.18 AS web-build
|
||||
COPY ui ui
|
||||
RUN cd ui && \
|
||||
|
|
@ -63,22 +63,14 @@ ENV MAXKB_VERSION="${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_C
|
|||
WORKDIR /opt/maxkb-app
|
||||
COPY --from=stage-build /opt/maxkb-app /opt/maxkb-app
|
||||
COPY --from=stage-build /opt/py3 /opt/py3
|
||||
COPY --from=vector-model /opt/maxkb/app/model /opt/maxkb-app/model
|
||||
COPY --from=vector-model /opt/maxkb-app/model /opt/maxkb-app/model
|
||||
|
||||
RUN chmod 755 /opt/maxkb-app/installer/*.sh && \
|
||||
cp -f /opt/maxkb-app/installer/*.sh /usr/bin/ && \
|
||||
cp -f /opt/maxkb-app/installer/init.sql /docker-entrypoint-initdb.d && \
|
||||
rm -rf /opt/maxkb-app/installer && \
|
||||
cp -r /opt/maxkb-app/model/base/hub /opt/maxkb-app/model/tokenizer && \
|
||||
curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
|
||||
mkdir -p /opt/maxkb-app/sandbox/ && \
|
||||
RUN curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
|
||||
find /opt/maxkb-app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} + && \
|
||||
chmod 755 /tmp && \
|
||||
useradd --no-create-home --home /opt/maxkb-app/sandbox sandbox -g root && \
|
||||
chown -R sandbox:root /opt/maxkb-app/sandbox && \
|
||||
chmod g-x /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \
|
||||
chmod g+x /usr/local/bin/python* && \
|
||||
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx
|
||||
chmod g+x /usr/local/bin/python*
|
||||
|
||||
EXPOSE 8080
|
||||
VOLUME /opt/maxkb
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
FROM python:3.11-slim-bullseye AS python-stage
|
||||
FROM postgres:17.4-bullseye
|
||||
|
||||
COPY --from=python-stage /usr/local /usr/local
|
||||
COPY installer/*.sh /usr/bin/
|
||||
COPY installer/init.sql /docker-entrypoint-initdb.d/
|
||||
|
||||
ARG DEPENDENCIES=" \
|
||||
libexpat1-dev \
|
||||
libffi-dev \
|
||||
|
|
@ -17,9 +21,10 @@ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|||
echo "Asia/Shanghai" > /etc/timezone && \
|
||||
apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES && \
|
||||
apt-get clean all && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=python-stage /usr/local /usr/local
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
chmod 755 /usr/bin/start-*.sh && \
|
||||
chmod 755 /tmp && \
|
||||
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx
|
||||
|
||||
ENV PGDATA=/opt/maxkb/data/postgresql/pgdata \
|
||||
POSTGRES_USER=root \
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
FROM python:3.11-slim-bookworm AS vector-model
|
||||
|
||||
COPY installer/install_model.py install_model.py
|
||||
RUN pip3 install --upgrade pip setuptools && \
|
||||
pip install pycrawlers && \
|
||||
pip install transformers && \
|
||||
python3 install_model.py && \
|
||||
cp -r model/base/hub model/tokenizer
|
||||
|
||||
FROM scratch
|
||||
COPY --from=vector-model model /opt/maxkb-app/model
|
||||
Loading…
Reference in New Issue