summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aai-resources/src/main/docker/docker-entrypoint.sh28
-rw-r--r--aai-resources/src/main/resources/docker/Dockerfile31
2 files changed, 27 insertions, 32 deletions
diff --git a/aai-resources/src/main/docker/docker-entrypoint.sh b/aai-resources/src/main/docker/docker-entrypoint.sh
index d268888..6f9ed65 100644
--- a/aai-resources/src/main/docker/docker-entrypoint.sh
+++ b/aai-resources/src/main/docker/docker-entrypoint.sh
@@ -54,7 +54,33 @@ if [ -f ${APP_HOME}/aai.sh ]; then
mv ${APP_HOME}/aai.sh /etc/profile.d/aai.sh
chmod 755 /etc/profile.d/aai.sh
- gosu aaiadmin /opt/app/aai-resources/scripts/createDBSchema.sh || exit 1
+ scriptName=$1;
+
+ if [ ! -z $scriptName ]; then
+
+ if [ -f ${APP_HOME}/bin/${scriptName} ]; then
+ shift 1;
+ gosu aaiadmin ${APP_HOME}/bin/${scriptName} "$@" || {
+ echo "Failed to run the ${scriptName}";
+ exit 1;
+ }
+ else
+ echo "Unable to find the script ${scriptName} in ${APP_HOME}/bin";
+ exit 1;
+ fi;
+
+ exit 0;
+ fi;
+
+
+ # If in the environment file skip create db schema there is a value set
+ # Then it will skip the create db schema at startup
+ # This is a workaround that will be there temporarily
+ # Ideally createDBSchema should be run from chef
+ # Or run without having to startup the application
+ if [ -z ${SKIP_CREATE_DB_SCHEMA_AT_STARTUP} ]; then
+ gosu aaiadmin /opt/app/aai-resources/scripts/createDBSchema.sh || exit 1
+ fi;
fi;
JAVA_CMD="exec gosu aaiadmin java";
diff --git a/aai-resources/src/main/resources/docker/Dockerfile b/aai-resources/src/main/resources/docker/Dockerfile
deleted file mode 100644
index dcbae0c..0000000
--- a/aai-resources/src/main/resources/docker/Dockerfile
+++ /dev/null
@@ -1,31 +0,0 @@
-FROM aaionap/aai-common:1.1.0
-
-RUN mkdir -p /opt/aaihome/aaiadmin /opt/aai/logroot/AAI-RES /opt/app/aai-resources/bin /opt/app/aai-resources/extApps;
-
-# Add the proper files into the docker image from your build
-ADD ./opt/app/aai-resources /opt/app/aai-resources
-ADD ./commonLibs/ /opt/app/commonLibs/
-ADD init-chef.sh /opt/app/aai-resources/init-chef.sh
-ADD docker-entrypoint.sh /opt/app/aai-resources/docker-entrypoint.sh
-ADD aai.sh /etc/profile.d/aai.sh
-
-# Change the permissions of aai shell script and all scripts in the microservice to be executable
-RUN chmod 644 /etc/profile.d/aai.sh && \
- find /opt/app/aai-resources -name "*.sh" -exec chmod 755 {} +
-
-# Set the log directory to be mountable so the logs will be persisted
-VOLUME /opt/aai/logroot/AAI-RES
-
-# Expose the ports that needs to be available from the container
-EXPOSE 8447
-
-# During the startup of the container, this will be the starting directory
-WORKDIR /opt/app/aai-resources
-
-# When the container is started this is the entrypoint script
-# that docker will run. Make sure this script doesn't end abruptly
-# Docker entrypoint will run exec command to make that main process
-# Using the exec form here will ensure the java process is main
-
-ENTRYPOINT ["/bin/bash", "/opt/app/aai-resources/docker-entrypoint.sh"]
-