Browse Source

chore: revise build-local-docker-image.sh

pull/5903/head
Wing-Kam Wong 1 year ago
parent
commit
4f6bca20be
  1. 21
      build-local-docker-image.sh

21
build-local-docker-image.sh

@ -2,7 +2,7 @@
# script to build local docker image. # script to build local docker image.
# highlevel steps involved # highlevel steps involved
# 1. Stop and remove existing container and image # 1. Stop and remove existing container and image
# 2. Build nocodb-sdk # 2. Install dependencies
# 3. Build nc-gui # 3. Build nc-gui
# 3a. static build of nc-gui # 3a. static build of nc-gui
# 3b. copy nc-gui build to nocodb dir # 3b. copy nc-gui build to nocodb dir
@ -23,11 +23,10 @@ function remove_image() {
docker rmi nocodb-local >/dev/null 2>&1 docker rmi nocodb-local >/dev/null 2>&1
} }
function build_sdk(){ function install_dependencies() {
# build nocodb-sdk # Install all dependencies
cd ${SCRIPT_DIR}/packages/nocodb-sdk cd ${SCRIPT_DIR}
pnpm --filter=!playwright install --frozen-lockfile || ERROR="sdk build failed" pnpm bootstrap || ERROR="install_dependencies failed"
pnpm run build || ERROR="sdk build failed"
} }
function build_gui(){ function build_gui(){
@ -35,7 +34,6 @@ function build_gui(){
export NODE_OPTIONS="--max_old_space_size=16384" export NODE_OPTIONS="--max_old_space_size=16384"
# generate static build of nc-gui # generate static build of nc-gui
cd ${SCRIPT_DIR}/packages/nc-gui cd ${SCRIPT_DIR}/packages/nc-gui
pnpm --filter=!playwright install --frozen-lockfile || ERROR="gui build failed"
pnpm run generate || ERROR="gui build failed" pnpm run generate || ERROR="gui build failed"
} }
@ -48,7 +46,6 @@ function package_nocodb(){
#build nocodb #build nocodb
# build nocodb ( pack nocodb-sdk and nc-gui ) # build nocodb ( pack nocodb-sdk and nc-gui )
cd ${SCRIPT_DIR}/packages/nocodb cd ${SCRIPT_DIR}/packages/nocodb
pnpm install --frozen-lockfile || ERROR="package_nocodb failed"
EE=true ./node_modules/.bin/webpack --config webpack.local.config.js || ERROR="package_nocodb failed" EE=true ./node_modules/.bin/webpack --config webpack.local.config.js || ERROR="package_nocodb failed"
} }
@ -73,11 +70,11 @@ echo "Info: Stopping and removing existing container and image" | tee ${LOG_FILE
stop_and_remove_container stop_and_remove_container
remove_image remove_image
echo "Info: Building nocodb-sdk" | tee -a ${LOG_FILE} echo "Info: Installing dependencies" | tee -a ${LOG_FILE}
build_sdk 1>> ${LOG_FILE} 2>> ${LOG_FILE} install_dependencies 1>> ${LOG_FILE} 2>> ${LOG_FILE}
echo "Info: Building nc-gui" | tee -a ${LOG_FILE} echo "Info: Building nc-gui" | tee -a ${LOG_FILE}
build_gui 1>> ${LOG_FILE} 2>> ${LOG_FILE} build_gui 1>> ${LOG_FILE} 2>> ${LOG_FILE}
echo "Info: Copy nc-gui build to nocodb dir" | tee -a ${LOG_FILE} echo "Info: Copy nc-gui build to nocodb dir" | tee -a ${LOG_FILE}
copy_gui_artifacts 1>> ${LOG_FILE} 2>> ${LOG_FILE} copy_gui_artifacts 1>> ${LOG_FILE} 2>> ${LOG_FILE}
@ -90,4 +87,4 @@ if [[ ${ERROR} == "" ]]; then
build_image 1>> ${LOG_FILE} 2>> ${LOG_FILE} build_image 1>> ${LOG_FILE} 2>> ${LOG_FILE}
fi fi
log_message | tee -a ${LOG_FILE} log_message | tee -a ${LOG_FILE}

Loading…
Cancel
Save