Skip to content

Commit 996ebea

Browse files
build: update dockerfiles.
1 parent bb0ad0a commit 996ebea

File tree

6 files changed

+27
-21
lines changed

6 files changed

+27
-21
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.git*
22
.idea*
3+
installer/

.github/workflows/build-and-push-python-pg.yml renamed to .github/workflows/build-and-push-base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ jobs:
6060
password: ${{ secrets.GH_TOKEN }}
6161
- name: Docker Buildx (build-and-push)
6262
run: |
63-
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile-python-pg
63+
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} -f installer/Dockerfile-base

.github/workflows/build-and-push-vector-model.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
dockerImageTag:
77
description: 'Docker Image Tag'
8-
default: 'v1.0.1'
8+
default: 'v2.0.0'
99
required: true
1010
architecture:
1111
description: 'Architecture'
@@ -19,7 +19,7 @@ on:
1919

2020
jobs:
2121
build-and-push-vector-model-to-ghcr:
22-
runs-on: ubuntu-22.04
22+
runs-on: ubuntu-latest
2323
steps:
2424
- name: Check Disk Space
2525
run: df -h
@@ -55,9 +55,6 @@ jobs:
5555
${DOCKER_IMAGE_TAGS} .
5656
- name: Set up QEMU
5757
uses: docker/setup-qemu-action@v3
58-
with:
59-
# Until https://github.com/tonistiigi/binfmt/issues/215
60-
image: tonistiigi/binfmt:qemu-v7.0.0-28
6158
- name: Set up Docker Buildx
6259
uses: docker/setup-buildx-action@v3
6360
- name: Login to GitHub Container Registry

installer/Dockerfile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/1panel-dev/maxkb-vector-model:v1.0.1 AS vector-model
1+
FROM ghcr.io/1panel-dev/maxkb-vector-model:v2.0.0 AS vector-model
22
FROM node:18-alpine3.18 AS web-build
33
COPY ui ui
44
RUN cd ui && \
@@ -63,22 +63,14 @@ ENV MAXKB_VERSION="${DOCKER_IMAGE_TAG} (build at ${BUILD_AT}, commit: ${GITHUB_C
6363
WORKDIR /opt/maxkb-app
6464
COPY --from=stage-build /opt/maxkb-app /opt/maxkb-app
6565
COPY --from=stage-build /opt/py3 /opt/py3
66-
COPY --from=vector-model /opt/maxkb/app/model /opt/maxkb-app/model
66+
COPY --from=vector-model /opt/maxkb-app/model /opt/maxkb-app/model
6767

68-
RUN chmod 755 /opt/maxkb-app/installer/*.sh && \
69-
cp -f /opt/maxkb-app/installer/*.sh /usr/bin/ && \
70-
cp -f /opt/maxkb-app/installer/init.sql /docker-entrypoint-initdb.d && \
71-
rm -rf /opt/maxkb-app/installer && \
72-
cp -r /opt/maxkb-app/model/base/hub /opt/maxkb-app/model/tokenizer && \
73-
curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
74-
mkdir -p /opt/maxkb-app/sandbox/ && \
68+
RUN curl -L --connect-timeout 120 -m 1800 https://resource.fit2cloud.com/maxkb/ffmpeg/get-ffmpeg-linux | sh && \
7569
find /opt/maxkb-app -mindepth 1 -not -name 'sandbox' -exec chmod 700 {} + && \
76-
chmod 755 /tmp && \
7770
useradd --no-create-home --home /opt/maxkb-app/sandbox sandbox -g root && \
7871
chown -R sandbox:root /opt/maxkb-app/sandbox && \
7972
chmod g-x /usr/local/bin/* /usr/bin/* /bin/* /usr/sbin/* /sbin/* /usr/lib/postgresql/17/bin/* && \
80-
chmod g+x /usr/local/bin/python* && \
81-
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx
73+
chmod g+x /usr/local/bin/python*
8274

8375
EXPOSE 8080
8476
VOLUME /opt/maxkb
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
FROM python:3.11-slim-bullseye AS python-stage
22
FROM postgres:17.4-bullseye
33

4+
COPY --from=python-stage /usr/local /usr/local
5+
COPY installer/*.sh /usr/bin/
6+
COPY installer/init.sql /docker-entrypoint-initdb.d/
7+
48
ARG DEPENDENCIES=" \
59
libexpat1-dev \
610
libffi-dev \
@@ -17,9 +21,10 @@ RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
1721
echo "Asia/Shanghai" > /etc/timezone && \
1822
apt-get update && apt-get install -y --no-install-recommends $DEPENDENCIES && \
1923
apt-get clean all && \
20-
rm -rf /var/lib/apt/lists/*
21-
22-
COPY --from=python-stage /usr/local /usr/local
24+
rm -rf /var/lib/apt/lists/* && \
25+
chmod 755 /usr/bin/start-*.sh && \
26+
chmod 755 /tmp && \
27+
find /etc/ -type f ! -path '/etc/resolv.conf' ! -path '/etc/hosts' | xargs chmod g-rx
2328

2429
ENV PGDATA=/opt/maxkb/data/postgresql/pgdata \
2530
POSTGRES_USER=root \

installer/Dockerfile-vector-model

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM python:3.11-slim-bookworm AS vector-model
2+
3+
COPY installer/install_model.py install_model.py
4+
RUN pip3 install --upgrade pip setuptools && \
5+
pip install pycrawlers && \
6+
pip install transformers && \
7+
python3 install_model.py && \
8+
cp -r model/base/hub model/tokenizer
9+
10+
FROM scratch
11+
COPY --from=vector-model model /opt/maxkb-app/model

0 commit comments

Comments
 (0)