diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-08-10 11:37:58 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-08-10 11:37:58 +0200 |
commit | 672eeaa0f6cc0389b0a9398f3de319d40d783c2c (patch) | |
tree | d954504fcadc52f4aa9e67fb1faee912144fcdc3 | |
parent | 0dcaef48dbae542f9b0212acbe957718643f5e34 (diff) |
Make graphadmin compatible with a read-only filesystem
- 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>
-rwxr-xr-x | src/main/docker/Dockerfile | 7 | ||||
-rw-r--r-- | src/main/docker/docker-entrypoint.sh | 33 |
2 files changed, 17 insertions, 23 deletions
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 6a1a05c..88faf79 100755 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -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"] diff --git a/src/main/docker/docker-entrypoint.sh b/src/main/docker/docker-entrypoint.sh index 78bb479..9232398 100644 --- a/src/main/docker/docker-entrypoint.sh +++ b/src/main/docker/docker-entrypoint.sh @@ -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 |