38 lines
1.9 KiB
Docker
38 lines
1.9 KiB
Docker
FROM node:24-alpine AS web-build
|
|
WORKDIR /build/ui
|
|
COPY ui/package.json ui/pnpm-lock.yaml ui/pnpm-workspace.yaml ./
|
|
RUN npm install -g pnpm@11.23.0 && pnpm install --frozen-lockfile
|
|
COPY ui/ ./
|
|
# Never reuse dist or Vite's relative development base for a release.
|
|
RUN rm -rf dist && npm run build-only -- --base /admin/ && npm run build-only-chat -- --base /chat/ && \
|
|
test -f dist/admin/index.html && test -f dist/chat/index.html && \
|
|
grep -q '/admin/assets/' dist/admin/index.html
|
|
|
|
FROM ghcr.io/1panel-dev/maxkb-base:python3.11-pg17.6 AS backend-build
|
|
WORKDIR /opt/maxkb-app
|
|
COPY . .
|
|
RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ gettext libexpat1-dev libffi-dev && \
|
|
gcc -shared -fPIC -o ${MAXKB_SANDBOX_HOME}/sandbox.so installer/sandbox.c -ldl && \
|
|
pip install uv --break-system-packages && python -m uv pip install -r pyproject.toml && \
|
|
python apps/manage.py compilemessages && \
|
|
python -m uv pip install --target=/opt/maxkb-app/sandbox/python-packages requests pymysql psycopg2-binary && \
|
|
rm -rf ui installer deploy_artifacts && rm -rf /var/lib/apt/lists/*
|
|
|
|
FROM ghcr.io/1panel-dev/maxkb-base:python3.11-pg17.6
|
|
ARG RELEASE_VERSION
|
|
ARG GITHUB_COMMIT
|
|
LABEL io.unis.component=kb io.unis.layout=refact org.opencontainers.image.revision=${GITHUB_COMMIT}
|
|
ENV MAXKB_VERSION="${RELEASE_VERSION} (${GITHUB_COMMIT})" \
|
|
AI_HUB_ASSET_DIR=/opt/maxkb/data/ai-hub-assets
|
|
WORKDIR /opt/maxkb-app
|
|
COPY --from=backend-build /opt/maxkb-app /opt/maxkb-app
|
|
COPY --from=backend-build /opt/py3 /opt/py3
|
|
# main.py collect_static also uses ui/dist. Ship both locations in the image.
|
|
COPY --from=web-build /build/ui/dist /opt/maxkb-app/ui/dist
|
|
COPY --from=web-build /build/ui/dist /opt/maxkb-app/apps/static
|
|
COPY deploy_artifacts/check_internal_services.py /usr/local/bin/unis-check-internal-services.py
|
|
EXPOSE 8080
|
|
VOLUME /opt/maxkb
|
|
ENTRYPOINT ["bash", "-c"]
|
|
CMD ["/usr/bin/start-all.sh"]
|