From 56b5b26ff5971b6d25b434eb006d27bc69829779 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 10 Oct 2024 15:45:03 +0530 Subject: [PATCH] chore: nightly docker build action without npm package deployment Signed-off-by: Pranav C --- .github/workflows/release-timely-docker.yml | 41 +++++++-------- packages/nocodb/webpack.timely.config.js | 57 +++++++++++++++++++++ 2 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 packages/nocodb/webpack.timely.config.js diff --git a/.github/workflows/release-timely-docker.yml b/.github/workflows/release-timely-docker.yml index 0aafadb4f8..ef08d2a8ee 100644 --- a/.github/workflows/release-timely-docker.yml +++ b/.github/workflows/release-timely-docker.yml @@ -86,33 +86,28 @@ jobs: with: node-version: 18.19.1 + - name: install dependencies + run: pnpm bootstrap + - name: Build gui and sdk run: | - export NODE_OPTIONS="--max_old_space_size=16384" - pnpm install --ignore-scripts --no-frozen-lockfile --ignore-workspace && - pnpm run build && - pnpm --filter=nc-gui install --ignore-scripts --no-frozen-lockfile && - pnpm --filter=nocodb-sdk install --ignore-scripts --no-frozen-lockfile - working-directory: ${{ env.working-directory }} - - name: upgrade packages for nightly build or pr build - if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }} - run: | - export NODE_OPTIONS="--max_old_space_size=16384" - NOCODB_SDK_PKG_NAME=nocodb-sdk-daily - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js && - pnpm --filter=${NOCODB_SDK_PKG_NAME} install --ignore-scripts --no-frozen-lockfile --ignore-workspace && pnpm --filter=${NOCODB_SDK_PKG_NAME} run build && - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk.js && - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && - pnpm --filter=nc-gui install --ignore-scripts --no-frozen-lockfile && - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} pnpm --filter=nc-gui run build:copy && - targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui.js + pnpm bootstrap && + cd packages/nc-gui && + pnpm run generate + + # copy build to nocodb + rsync -rvzh ./ee/dist/ ../nocodb/docker/nc-gui/ + - - name: Build nocodb and docker files + - name: build nocodb + if: ${{ ( github.event_name == 'schedule' ) || ( github.event.inputs.services_to_deploy == 'main_only' || github.event.inputs.services_to_deploy == 'all' ) }} run: | - pnpm install --ignore-scripts --no-frozen-lockfile - pnpm run docker:build - working-directory: ${{ env.working-directory }} + # build nocodb ( pack nocodb-sdk and nc-gui ) + cd packages/nocodb && + EE=true pnpm exec webpack --config webpack.timely.config.js && + # remove bundled libraries (nocodb-sdk, knex-snowflake) + pnpm uninstall --save-prod nocodb-sdk knex-snowflake knex-databricks - name: Set up QEMU uses: docker/setup-qemu-action@v2.1.0 @@ -143,7 +138,7 @@ jobs: platforms: linux/amd64,linux/arm64,linux/arm/v7 cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new - push: true + push: false tags: | nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_LATEST_TAG }} diff --git a/packages/nocodb/webpack.timely.config.js b/packages/nocodb/webpack.timely.config.js new file mode 100644 index 0000000000..6ce52c0a93 --- /dev/null +++ b/packages/nocodb/webpack.timely.config.js @@ -0,0 +1,57 @@ +const path = require('path'); +const nodeExternals = require('webpack-node-externals'); +const webpack = require('webpack'); +const CopyPlugin = require('copy-webpack-plugin'); +const TerserPlugin = require('terser-webpack-plugin'); +const { resolveTsAliases } = require('./build-utils/resolveTsAliases'); + +module.exports = { + entry: './src/run/cloud.ts', + module: { + rules: [ + { + test: /\.tsx?$/, + exclude: /node_modules/, + use: { + loader: 'ts-loader', + options: { + transpileOnly: true, + }, + }, + }, + ], + }, + + optimization: { + minimize: true, //Update this to true or false + minimizer: [new TerserPlugin()], + nodeEnv: false, + }, + externals: [ + nodeExternals({ + allowlist: ['nocodb-sdk'], + }), + ], + resolve: { + extensions: ['.tsx', '.ts', '.js', '.json'], + alias: resolveTsAliases(path.resolve('./src/ee-cloud/tsconfig.json')), + }, + mode: 'production', + output: { + filename: 'main.js', + path: path.resolve(__dirname, 'docker'), + library: 'libs', + libraryTarget: 'umd', + globalObject: "typeof self !== 'undefined' ? self : this", + }, + node: { + __dirname: false, + }, + plugins: [ + new webpack.EnvironmentPlugin(['EE']), + new CopyPlugin({ + patterns: [{ from: 'src/public', to: 'public' }], + }), + ], + target: 'node', +};