build: update dockerfiles.
This commit is contained in:
parent
bb0ad0a27b
commit
996ebea316
@ -1,2 +1,3 @@
|
|||||||
.git*
|
.git*
|
||||||
.idea*
|
.idea*
|
||||||
|
installer/
|
||||||
@ -60,4 +60,4 @@ jobs:
|
|||||||
password: ${{ secrets.GH_TOKEN }}
|
password: ${{ secrets.GH_TOKEN }}
|
||||||
- name: Docker Buildx (build-and-push)
|
- name: Docker Buildx (build-and-push)
|
||||||
run: |
|
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:
|
inputs:
|
||||||
dockerImageTag:
|
dockerImageTag:
|
||||||
description: 'Docker Image Tag'
|
description: 'Docker Image Tag'
|
||||||
default: 'v1.0.1'
|
default: 'v2.0.0'
|
||||||
required: true
|
required: true
|
||||||
architecture:
|
architecture:
|
||||||
description: 'Architecture'
|
description: 'Architecture'
|
||||||
@ -19,7 +19,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-vector-model-to-ghcr:
|
build-and-push-vector-model-to-ghcr:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check Disk Space
|
- name: Check Disk Space
|
||||||
run: df -h
|
run: df -h
|
||||||
@ -55,9 +55,6 @@ jobs:
|
|||||||
${DOCKER_IMAGE_TAGS} .
|
${DOCKER_IMAGE_TAGS} .
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
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
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to GitHub Container Registry
|
- 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
|
FROM node:18-alpine3.18 AS web-build
|
||||||
COPY ui ui
|
COPY ui ui
|
||||||
RUN cd 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
|
WORKDIR /opt/maxkb-app
|
||||||
COPY --from=stage-build /opt/maxkb-app /opt/maxkb-app
|
COPY --from=stage-build /opt/maxkb-app /opt/maxkb-app
|
||||||
COPY --from=stage-build /opt/py3 /opt/py3
|
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 && \
|
RUN curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | 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/ && \
|
|
||||||
find /opt/maxkb-app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} + && \
|
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 && \
|
useradd --no-create-home --home /opt/maxkb-app/sandbox sandbox -g root && \
|
||||||
chown -R sandbox:root /opt/maxkb-app/sandbox && \
|
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/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \
|
||||||
chmod g+x /usr/local/bin/python* && \
|
chmod g+x /usr/local/bin/python*
|
||||||
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx
|
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
VOLUME /opt/maxkb
|
VOLUME /opt/maxkb
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
FROM python:3.11-slim-bullseye AS python-stage
|
FROM python:3.11-slim-bullseye AS python-stage
|
||||||
FROM postgres:17.4-bullseye
|
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=" \
|
ARG DEPENDENCIES=" \
|
||||||
libexpat1-dev \
|
libexpat1-dev \
|
||||||
libffi-dev \
|
libffi-dev \
|
||||||
@ -17,9 +21,10 @@ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|||||||
echo "Asia/Shanghai" > /etc/timezone && \
|
echo "Asia/Shanghai" > /etc/timezone && \
|
||||||
apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES && \
|
apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES && \
|
||||||
apt-get clean all && \
|
apt-get clean all && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
chmod 755 /usr/bin/start-*.sh && \
|
||||||
COPY --from=python-stage /usr/local /usr/local
|
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 \
|
ENV PGDATA=/opt/maxkb/data/postgresql/pgdata \
|
||||||
POSTGRES_USER=root \
|
POSTGRES_USER=root \
|
||||||
11
installer/Dockerfile-vector-model
Normal file
11
installer/Dockerfile-vector-model
Normal file
@ -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
Block a user