-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathbuild-ui-image.sh
More file actions
executable file
·66 lines (51 loc) · 1.45 KB
/
build-ui-image.sh
File metadata and controls
executable file
·66 lines (51 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
set -e
cd "$(dirname "$(dirname "$0")")"
npm install --no-save yaml
function value() {
node ./scripts/value.js "$1"
}
function image() {
local REPOSITORY="$(value "$1.image.repository")"
local TAG="$(value "$1.image.tag")"
if [ "$TAG" != "" ]; then
echo "$REPOSITORY:$TAG"
else
echo "$REPOSITORY"
fi
}
rm -rf gen/ui
mkdir -p gen/ui/resources
CLOUD_SERVICE="$(value html5_apps_deployer.cloudService)"
DESTINATIONS="$(value html5_apps_deployer.backendDestinations)"
IMAGE="$(image html5_apps_deployer)"
for APP in app/*; do
if [ -f "$APP/webapp/manifest.json" ]; then
echo "Build $APP..."
echo
rm -rf "gen/$APP"
mkdir -p "gen/app"
cp -r "$APP" gen/app
pushd >/dev/null "gen/$APP"
node ../../../scripts/prepareUiFiles.js $CLOUD_SERVICE $DESTINATIONS
npm install
npx ui5 build preload --clean-dest --config ui5-deploy.yaml --include-task=generateManifestBundle generateCachebusterInfo
cd dist
rm manifest-bundle.zip
mv *.zip ../../../ui/resources
popd >/dev/null
fi
done
cd gen/ui
echo
echo "HTML5 Apps:"
ls -l resources
echo
cat >package.json <<EOF
{
"name": "ui-deployer",
"scripts": { "start": "node node_modules/@sap/html5-app-deployer/index.js" }
}
EOF
npm install @sap/html5-app-deployer
pack build $IMAGE --path . --buildpack gcr.io/paketo-buildpacks/nodejs --builder paketobuildpacks/builder:base