Build: Run `npm run dev` on development build

This commit is contained in:
Ilija Lazoroski 2022-04-12 14:43:15 +02:00 committed by ilija-lazoroski
parent 5bed5b7d7c
commit 27d47c05c4
4 changed files with 18 additions and 4 deletions

View File

@ -28,6 +28,7 @@ setup_build_dir() {
local agent_binary_dir=$1
local monkey_repo=$2
local deployment_type=$3
local is_release_build=$4
pushd $APPIMAGE_DIR
@ -44,7 +45,7 @@ setup_build_dir() {
install_mongodb
generate_ssl_cert "$BUILD_DIR"
build_frontend "$BUILD_DIR"
build_frontend "$BUILD_DIR" "$is_release_build"
remove_python_appdir_artifacts

View File

@ -196,8 +196,13 @@ fi
install_build_prereqs
install_package_specific_build_prereqs "$WORKSPACE"
is_release_build=false
# Monkey version is empty on release build
if [ ! -z "$monkey_version" ]; then
is_release_build=true
fi
setup_build_dir "$agent_binary_dir" "$monkey_repo" "$deployment_type"
setup_build_dir "$agent_binary_dir" "$monkey_repo" "$deployment_type" "$is_release_build"
commit_id=$(get_commit_id "$monkey_repo")
build_package "$monkey_version" "$commit_id" "$DIST_DIR"

View File

@ -74,11 +74,18 @@ generate_ssl_cert() {
build_frontend() {
local ui_dir="$1/monkey_island/cc/ui"
local is_release_build=$2
pushd "$ui_dir" || handle_error
log_message "Generating front end"
npm ci
if [ "$is_release_build" == true ]; then
log_message "Running production front end build"
npm run dist
else
log_message "Running development front end build"
npm run dev
fi
popd || handle_error

View File

@ -9,6 +9,7 @@ install_package_specific_build_prereqs() {
setup_build_dir() {
local agent_binary_dir=$1
local monkey_repo=$2
local is_release_build=$4
local build_dir=$DOCKER_DIR/monkey
mkdir "$build_dir"
@ -22,7 +23,7 @@ setup_build_dir() {
generate_ssl_cert "$build_dir"
build_frontend "$build_dir"
build_frontend "$build_dir" "$is_release_build"
}
copy_entrypoint_to_build_dir() {