2 # Builds Portal, Portal-SDK and DMaaP-BC webapps;
3 # then packages all into a docker.
4 # Prereq: all three projects have been cloned from git.
5 # Expects to be invoked with CWD=portal/deliveries
6 # Caches files in local directory for docker build.
8 # Stop on error; show output
11 # This reuses the docker-compose file
12 echo "Set image tag name variables"
13 source $(dirname $0)/.env
15 # Work standalone AND in the ONAP Jenkins.
16 # Pick up Jenkins settings for this script.
17 # Use -B for batch operation to skip download progress output
18 if [ -n "$MVN" ]; then
19 export MVN="${MVN} -B -gs ${GLOBAL_SETTINGS_FILE} -s ${SETTINGS_FILE}"
21 # Force refresh of snapshots
25 # This expects to start in the deliveries folder; make sure
26 PORTAL_DOCKERFILE=Dockerfile.portalapps
27 if [ ! -f $PORTAL_DOCKERFILE ] ; then
28 echo "Failed to find file ${PORTAL_DOCKERFILE}; must start in deliveries folder; exiting"
32 # Store directory names as variables
33 # This is the Docker Project area.
35 # parent directory, for finding source projects
40 # Relative path of temp directory
42 # Absolute path of temp directory
43 BUILD_ABS=$DELIV/$BUILD_REL
47 # Copy DDL/DML to required directories
49 # RELATIVE PATHS to local directories with database scripts
50 # bcos Docker looks within this build area only
51 SCR_BASE=$BUILD_REL/scripts
52 PORTAL_SCRIPT_DIR=$SCR_BASE/ecomp-portal-DB-os
53 SDK_SCRIPT_DIR=$SCR_BASE/epsdk-app-os
54 DBC_SCRIPT_DIR=$SCR_BASE/dbca-os
55 mkdir -p ${PORTAL_SCRIPT_DIR} ${SDK_SCRIPT_DIR} ${DBC_SCRIPT_DIR}
57 # copy over DB scripts for the dockerfiles
59 cp $BASE/ecomp-portal-DB-common/*.sql ${PORTAL_SCRIPT_DIR}
60 cp $BASE/ecomp-portal-DB-os/*.sql ${PORTAL_SCRIPT_DIR}
62 cp $BASE/sdk/ecomp-sdk/epsdk-app-common/db-scripts/*.sql ${SDK_SCRIPT_DIR}
63 cp $BASE/sdk/ecomp-sdk/epsdk-app-os/db-scripts/*.sql ${SDK_SCRIPT_DIR}
65 cp $BASE/dmaapbc/dcae_dmaapbc_webapp/dbca-common/db-scripts/*.sql ${DBC_SCRIPT_DIR}
66 cp $BASE/dmaapbc/dcae_dmaapbc_webapp/dbca-os/db-scripts/*.sql ${DBC_SCRIPT_DIR}
67 # Assemble a script with "use" at the top.
68 cat $DBC_SCRIPT_DIR/dbca-create-mysql-1707-os.sql $DBC_SCRIPT_DIR/dbca-ddl-mysql-1707-common.sql $DBC_SCRIPT_DIR/dbca-dml-mysql-1707-os.sql > $DBC_SCRIPT_DIR/dbca-complete-mysql-1707-os.sql
70 # build database docker
72 docker build -t ${DB_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
73 --build-arg PORTAL_SCRIPT_DIR=${PORTAL_SCRIPT_DIR}
74 --build-arg SDK_SCRIPT_DIR=${SDK_SCRIPT_DIR}
75 --build-arg DBC_SCRIPT_DIR=${DBC_SCRIPT_DIR}
76 -f Dockerfile.mariadb .
78 echo "Build mariadb docker image"
81 echo "Build all jar and war files in Portal"
85 echo "Copy Portal app BE"
86 cd $BASE/ecomp-portal-BE-os
87 cp target/ecompportal-be-os.war $BUILD_ABS
89 echo "Copy Portal app FE"
90 cd $BASE/ecomp-portal-FE-os/
91 cp -r dist/public $BUILD_ABS
93 echo "Copy Portal widget-ms"
94 cd $BASE/ecomp-portal-widget-ms
95 cp widget-ms/target/widget-ms.jar $BUILD_ABS
97 echo "Build and copy Portal-SDK app"
98 cd $BASE/sdk/ecomp-sdk/epsdk-app-os
100 cp target/epsdk-app-os.war $BUILD_ABS
102 echo "Build and copy Portal-DBC app"
103 cd $BASE/dmaapbc/dcae_dmaapbc_webapp
105 cp dbca-os/target/dmaap-bc-app-os.war $BUILD_ABS
108 if [ $HTTP_PROXY ]; then
109 PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
111 if [ $HTTPS_PROXY ]; then
112 PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
115 echo "Build portal docker image"
118 docker build -t ${EP_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
119 --build-arg FE_DIR=$BUILD_REL/public
120 --build-arg PORTAL_WAR=$BUILD_REL/ecompportal-be-os.war
121 --build-arg SDK_WAR=$BUILD_REL/epsdk-app-os.war
122 --build-arg DBC_WAR=$BUILD_REL/dmaap-bc-app-os.war
123 -f $PORTAL_DOCKERFILE .
127 echo "Bbuild widget-ms docker image"
129 docker build -t ${WMS_IMG_NAME}:${PORTAL_TAG} ${PROXY_ARGS}
130 --build-arg WMS_JAR=$BUILD_REL/widget-ms.jar
131 -f Dockerfile.widgetms .
135 # For ease of debugging, leave the build dir