diff --git a/.github/workflows/build_and_push.yml b/.github/workflows/build_and_push.yml index 0c95c539..00f9c2d2 100644 --- a/.github/workflows/build_and_push.yml +++ b/.github/workflows/build_and_push.yml @@ -42,6 +42,18 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - 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: Prepare id: prepare run: | @@ -77,6 +89,18 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.ref_name }} + - 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: Prepare id: prepare run: | diff --git a/Dockerfile b/Dockerfile index 654ca8e9..b1c1e925 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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