mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: docker build ui
perf: fix arm build perf: fix action push perf: action ci
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
name: build-test-image-ghcr
|
||||
|
||||
run-name: 构建分支 ${{ github.event.inputs.branch }} 镜像并推送 ghcr.io ${{ github.event.inputs.tag }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build'
|
||||
default: 'main'
|
||||
required: true
|
||||
tag:
|
||||
description: 'Image Tag'
|
||||
default: 'latest'
|
||||
required: true
|
||||
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.branch }}
|
||||
- name: Free Up GitHub Actions Ubuntu Runner Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
with:
|
||||
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
|
||||
tool-cache: false
|
||||
|
||||
# All of these default to true, but feel free to set to "false" if necessary for your workflow
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: false
|
||||
swap-storage: true
|
||||
- name: Setup Environment
|
||||
run: |
|
||||
echo "image_name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/sqlbot" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
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
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
provenance: false
|
||||
file: Dockerfile
|
||||
tags: ${{ env.image_name }}:${{ inputs.tag }}
|
||||
+26
-7
@@ -1,7 +1,18 @@
|
||||
# Build sqlbot
|
||||
FROM ghcr.io/1panel-dev/maxkb-vector-model:v1.0.1 AS vector-model
|
||||
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS sqlbot-builder
|
||||
FROM --platform=${BUILDPLATFORM} registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS sqlbot-ui-builder
|
||||
ENV SQLBOT_HOME=/opt/sqlbot
|
||||
ENV APP_HOME=${SQLBOT_HOME}/app
|
||||
ENV UI_HOME=${SQLBOT_HOME}/frontend
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN mkdir -p ${APP_HOME} ${UI_HOME}
|
||||
|
||||
COPY frontend /tmp/frontend
|
||||
RUN cd /tmp/frontend && npm install && npm run build && mv dist ${UI_HOME}/dist
|
||||
|
||||
|
||||
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS sqlbot-builder
|
||||
# Set build environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV SQLBOT_HOME=/opt/sqlbot
|
||||
@@ -18,10 +29,7 @@ RUN mkdir -p ${APP_HOME} ${UI_HOME}
|
||||
|
||||
WORKDIR ${APP_HOME}
|
||||
|
||||
COPY frontend /tmp/frontend
|
||||
|
||||
RUN cd /tmp/frontend; npm install; npm run build; mv dist ${UI_HOME}/dist
|
||||
|
||||
COPY --from=sqlbot-ui-builder ${UI_HOME} ${UI_HOME}
|
||||
# Install dependencies
|
||||
RUN test -f "./uv.lock" && \
|
||||
--mount=type=cache,target=/root/.cache/uv \
|
||||
@@ -33,16 +41,27 @@ COPY ./backend ${APP_HOME}
|
||||
|
||||
# Final sync to ensure all dependencies are installed
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --extra cpu
|
||||
uv sync --extra cpu
|
||||
|
||||
# Build g2-ssr
|
||||
FROM registry.cn-qingdao.aliyuncs.com/dataease/sqlbot-base:latest AS ssr-builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential python3 pkg-config \
|
||||
libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev \
|
||||
libpixman-1-dev libfreetype6-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# configure npm
|
||||
RUN npm config set fund false \
|
||||
&& npm config set audit false \
|
||||
&& npm config set progress false
|
||||
|
||||
COPY g2-ssr/app.js g2-ssr/package.json /app/
|
||||
COPY g2-ssr/charts/* /app/charts/
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Runtime stage
|
||||
|
||||
Reference in New Issue
Block a user