Switch to side-by-side view

--- a/scripts/bundle-functions.sh
+++ b/scripts/bundle-functions.sh
@@ -32,7 +32,7 @@
   ls ${C2NET_DIR}
 }
 
-function bundleComponent() {
+function buildComponent() {
   INITIAL_DIR="${PWD}"
   COMPONENT_NAME=$1
   RUNTIME=${2:-node}
@@ -53,17 +53,18 @@
 
     echo "  - Compiling using NodeJS runtime - c2netproject.eu/runtime/nodejs:1_0_0"
     # Launch npm install in a Docker container compatible with the Runtime
-    $DOCKER run --dns=192.168.0.11 --rm -v $PWD:/tmp/component --entrypoint=bash c2netproject.eu/runtime/nodejs:1_0_0 -c "$NPMINSTALL"
+    $DOCKER run --rm "$DNS" -v $PWD:/tmp/component --entrypoint=bash c2netproject.eu/runtime/nodejs:1_0_0 -c "$NPMINSTALL"
+
+
     echo "  - Completed npm install"
 
-    # Create code zip (src + package.json)
-    zip -q -r ${COMP_BUNDLES_DIR}/${CODE_ZIP_FILENAME} .
-    echo "  - Created code zip: ${CODE_ZIP_FILENAME}"
+    # Copy src + package.json to bundles
+    cp -fr ${COMP_DIR} ${COMP_BUNDLES_DIR}
+    echo "  - Component copied: ${COMPONENT_NAME}"
 
     # Remove node_modules (requires root)
     $DOCKER run --rm -v $PWD:/tmp/component --entrypoint=bash c2netproject.eu/runtime/nodejs:1_0_0 -c "rm -rf node_modules"
     echo "  - Deleted node_modules"
-
 
   elif [ "$RUNTIME" == "java" ]; then
     echo "  - Compiling using JAVA runtime: $DEV_DOCKER_IMAGE"
@@ -74,13 +75,13 @@
     echo "  - Created code zip: ${CODE_ZIP_FILENAME}"
     cd ..
 
-    $DOCKER run --dns=192.168.0.11 --rm -v $PWD:/tmp/component --entrypoint=bash $DEV_DOCKER_IMAGE -c 'rm -rf build'
+    $DOCKER run "$DNS" --rm -v $PWD:/tmp/component --entrypoint=bash $DEV_DOCKER_IMAGE -c 'rm -rf build'
     echo "  - Deleted build dir"
 
   elif [ "$RUNTIME" == "mariadb" ]; then
     echo "  - Compiling using MariaDB runtime - eslap.cloud/runtime/mariadb:1_0_0"
     # Launch npm install in a Docker container compatible with the Runtime
-    $DOCKER run --dns=192.168.0.11 --rm -v $PWD:/tmp/component --entrypoint=bash eslap.cloud/runtime/mariadb:1_0_0 -c "$NPMINSTALL"
+    $DOCKER run "$DNS" --rm -v $PWD:/tmp/component --entrypoint=bash eslap.cloud/runtime/mariadb:1_0_0 -c "$NPMINSTALL"
     echo "  - Completed npm install"
 
     # Create code zip (src + package.json)
@@ -92,33 +93,35 @@
     echo "  - Deleted node_modules"
   fi
 
-  cd ../..
-
-  cd ${COMP_BUNDLES_DIR}
-  COMP_BLOB_SHA1=$(sha1sum ${CODE_ZIP_FILENAME} | awk '{print $1}')
-  createBlobBundle ${BLOB_BUNDLE_COMPONENT_NAME} ${COMP_BLOB_SHA1}
-  echo "  - Generated blob manifest"
-
-  # Create component code blob bundle
-  zip -r blobBundle_component_${COMPONENT_NAME}.zip Manifest.json ${CODE_ZIP_FILENAME}
-  echo "  - Generated blob bundle for code: blobBundle_component_${COMPONENT_NAME}.zip"
-  mv Manifest.json Manifest_blob.json
-
-  # Create component bundle
-  cp ${COMP_DIR}/Manifest.json Manifest.json
-  sed -i -e "s/\"code\"\s*:\s*\".*\"/\"code\": \"${BLOB_BUNDLE_COMPONENT_NAME}\"/g" Manifest.json
-  rm -f component_bundle_${COMPONENT_NAME}.zip
-  zip -r $BUNDLES_DIR/component_bundle_${COMPONENT_NAME}.zip Manifest.json blobBundle_component_${COMPONENT_NAME}.zip
-  echo "  - Generated component bundle: component_bundle_${COMPONENT_NAME}.zip"
-  rm Manifest.json \
-    blobBundle_component_${COMPONENT_NAME}.zip \
-    Manifest_blob.json \
-    code.zip
-
-  # Reset the current directory to the original one
-  cd ${INITIAL_DIR}
-  rm -rf ${COMP_BUNDLES_DIR}
-  echo ""
+
+
+#  cd ../..
+#
+#  cd ${COMP_BUNDLES_DIR}
+#  COMP_BLOB_SHA1=$(sha1sum ${CODE_ZIP_FILENAME} | awk '{print $1}')
+#  createBlobBundle ${BLOB_BUNDLE_COMPONENT_NAME} ${COMP_BLOB_SHA1}
+#  echo "  - Generated blob manifest"
+#
+#  # Create component code blob bundle
+#  zip -r blobBundle_component_${COMPONENT_NAME}.zip Manifest.json ${CODE_ZIP_FILENAME}
+#  echo "  - Generated blob bundle for code: blobBundle_component_${COMPONENT_NAME}.zip"
+#  mv Manifest.json Manifest_blob.json
+#
+#  # Create component bundle
+#  cp ${COMP_DIR}/Manifest.json Manifest.json
+#  sed -i -e "s/\"code\"\s*:\s*\".*\"/\"code\": \"${BLOB_BUNDLE_COMPONENT_NAME}\"/g" Manifest.json
+#  rm -f component_bundle_${COMPONENT_NAME}.zip
+#  zip -r $BUNDLES_DIR/component_bundle_${COMPONENT_NAME}.zip Manifest.json blobBundle_component_${COMPONENT_NAME}.zip
+#  echo "  - Generated component bundle: component_bundle_${COMPONENT_NAME}.zip"
+#  rm Manifest.json \
+#    blobBundle_component_${COMPONENT_NAME}.zip \
+#    Manifest_blob.json \
+#    code.zip
+#
+#  # Reset the current directory to the original one
+#  cd ${INITIAL_DIR}
+#  rm -rf ${COMP_BUNDLES_DIR}
+#  echo ""
 }