Fix admportal image
authorPetr Ospalý <p.ospaly@partner.samsung.com>
Fri, 7 Jun 2019 16:30:36 +0000 (18:30 +0200)
committerPetr Ospalý <p.ospaly@partner.samsung.com>
Wed, 12 Jun 2019 15:27:34 +0000 (17:27 +0200)
Docker container should be stateless and be self-contained. When image
is run as container it should behave exactly the same with each run.

This commit moves npm install stuff into docker build stage where
it belongs.

Please, read:
https://docs.docker.com/get-started/part2/

Issue-ID: SDNC-685
Signed-off-by: Petr Ospalý <p.ospaly@partner.samsung.com>
Change-Id: I4ff18b313a9af400bbfc2cbf6f4a1b1334593d9a

admportal/shell/start_portal.sh
installation/admportal/src/main/docker/Dockerfile

index 8a0c445..36716f4 100755 (executable)
@@ -20,11 +20,12 @@ SSL_ENABLED=`python $PROJECT_HOME/admportal/shell/getAdmPortalProp.py sslEnabled
 export SSL_ENABLED
 
 if [ ! -d /opt/onap/sdnc/admportal/node_modules ]; then
-       cd /opt/onap/sdnc/admportal && npm install
+    echo "ERROR: missing node modules: /opt/onap/sdnc/admportal/node_modules"
+    exit 1
 fi
 
 cd /opt/onap/sdnc/admportal
-node shell/www
+exec node shell/www
 #if [ "true" == "${SSL_ENABLED}" ]; then
        #pm2 startOrRestart process.https.json
 #else
index 21cd7a3..f5b51d1 100644 (file)
@@ -8,5 +8,7 @@ MAINTAINER SDN-C Team (sdnc@lists.openecomp.org)
 # copy openecomp
 COPY opt /opt
 
+RUN cd /opt/onap/sdnc/admportal && npm install
+
 #ENTRYPOINT exec /opt/openecomp/sdnc/admportal/shell/startssl.sh
 EXPOSE 8843 8443