Make graphadmin compatible with a read-only filesystem 99/138699/1
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Sat, 10 Aug 2024 09:37:58 +0000 (11:37 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Sat, 10 Aug 2024 09:37:58 +0000 (11:37 +0200)
- move file modifying operations from the docker-entrypoint (runtime) to the Dockerfile (build time)

Issue-ID: AAI-3955
Change-Id: If7950c4a7074b5bd68b26f3294aa664ef8dd276c
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
src/main/docker/Dockerfile
src/main/docker/docker-entrypoint.sh

index 6a1a05c..88faf79 100755 (executable)
@@ -13,12 +13,17 @@ VOLUME /opt/aai/logroot/AAI-GA
 VOLUME /opt/data
 VOLUME /opt/tools
 
-# Add the proper files into the docker image from your build
 WORKDIR /opt/app/aai-graphadmin
 
 RUN chown -R nobody:nobody /opt/app/aai-graphadmin /etc/profile.d /opt/aai/logroot/AAI-GA /opt/app /opt/aai/logroot /opt/app/aai-graphadmin/logs/gc
 
 COPY --chown=nobody:nobody /maven/aai-graphadmin/ .
 
+RUN find /opt/app/ -name "*.sh" -exec chmod +x {} + && \
+    ln -s bin scripts && \
+    ln -s /opt/aai/logroot/AAI-GA logs && \
+    mv aai.sh /etc/profile.d/aai.sh && \
+    chmod 755 /etc/profile.d/aai.sh
+
 USER nobody
 ENTRYPOINT ["/bin/sh", "/opt/app/aai-graphadmin/docker-entrypoint.sh"]
index 78bb479..9232398 100644 (file)
@@ -23,33 +23,22 @@ RESOURCES_HOME=${APP_HOME}/resources/;
 
 export SERVER_PORT=${SERVER_PORT:-8449};
 
-find /opt/app/ -name "*.sh" -exec chmod +x {} +
+scriptName=$1;
 
-if [ -f ${APP_HOME}/aai.sh ]; then
-    ln -s bin scripts
-    ln -s /opt/aai/logroot/AAI-GA logs
+if [ ! -z $scriptName ]; then
 
-    mv ${APP_HOME}/aai.sh /etc/profile.d/aai.sh
-    chmod 755 /etc/profile.d/aai.sh
-
-    scriptName=$1;
-
-    if [ ! -z $scriptName ]; then
-
-        if [ -f ${APP_HOME}/bin/${scriptName} ]; then
-            shift 1;
-            ${APP_HOME}/bin/${scriptName} "$@" || {
-                echo "Failed to run the ${scriptName}";
-                exit 1;
-            }
-        else
-            echo "Unable to find the script ${scriptName} in ${APP_HOME}/bin";
+    if [ -f ${APP_HOME}/bin/${scriptName} ]; then
+        shift 1;
+        ${APP_HOME}/bin/${scriptName} "$@" || {
+            echo "Failed to run the ${scriptName}";
             exit 1;
-        fi;
-
-        exit 0;
+        }
+    else
+        echo "Unable to find the script ${scriptName} in ${APP_HOME}/bin";
+        exit 1;
     fi;
 
+    exit 0;
 fi;
 
 if [ -f ${APP_HOME}/resources/aai-graphadmin-swm-vars.sh ]; then