diff options
Diffstat (limited to 'auth/docker')
-rw-r--r-- | auth/docker/.gitignore | 1 | ||||
-rw-r--r-- | auth/docker/Dockerfile.base | 2 | ||||
-rw-r--r-- | auth/docker/Dockerfile.client | 4 | ||||
-rw-r--r-- | auth/docker/Dockerfile.config | 5 | ||||
-rw-r--r-- | auth/docker/Dockerfile.core | 2 | ||||
-rw-r--r-- | auth/docker/Dockerfile.ms | 8 | ||||
-rw-r--r-- | auth/docker/aaf.sh | 5 | ||||
-rw-r--r-- | auth/docker/agent.sh | 28 | ||||
-rwxr-xr-x | auth/docker/dbuild.sh | 10 |
9 files changed, 44 insertions, 21 deletions
diff --git a/auth/docker/.gitignore b/auth/docker/.gitignore index 1c98ea37..ad950a43 100644 --- a/auth/docker/.gitignore +++ b/auth/docker/.gitignore @@ -8,3 +8,4 @@ /*.orig /.curl_auth /test.sh +/*.tgz diff --git a/auth/docker/Dockerfile.base b/auth/docker/Dockerfile.base index 879c3191..f76a3555 100644 --- a/auth/docker/Dockerfile.base +++ b/auth/docker/Dockerfile.base @@ -23,5 +23,5 @@ MAINTAINER AAF Team, AT&T 2018 LABEL description="aaf_base" RUN apk add --no-cache bash RUN apk add --no-cache openssl -RUN addgroup ${USER} && adduser ${USER} -G ${USER} -D -s /bin/bash +RUN if [ -n "${DUSER}" ]; then addgroup ${DUSER} && adduser ${DUSER} -G ${DUSER} -D -s /bin/bash; fi diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client index d0c20578..e50810fe 100644 --- a/auth/docker/Dockerfile.client +++ b/auth/docker/Dockerfile.client @@ -31,6 +31,6 @@ COPY bin/aaf-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ COPY bin/aaf-cadi-servlet-sample-*-sample.jar /opt/app/aaf_config/bin/ COPY cert/*trust*.b64 /opt/app/aaf_config/cert/ -RUN chown -R ${USER}:${USER} /opt/app/aaf_config +RUN if [ -n "${DUSER}" ]; then chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi -CMD ["/bin/bash","-c","/opt/app/aaf_config/bin/agent.sh"] +CMD [] diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config index a6d6d4f1..9a5fbb47 100644 --- a/auth/docker/Dockerfile.config +++ b/auth/docker/Dockerfile.config @@ -37,8 +37,7 @@ COPY bin/pod_wait.sh /opt/app/aaf_config/bin/ COPY bin/aaf-auth-cmd-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ COPY bin/aaf-auth-batch-${AAF_VERSION}-full.jar /opt/app/aaf_config/bin/ -RUN chown -R ${USER}:${USER} /opt/app/aaf_config -RUN mkdir -p /opt/app/osaaf && chown ${USER}:${USER} /opt/app/osaaf +RUN mkdir -p /opt/app/osaaf +RUN if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/osaaf && chown -R ${DUSER}:${DUSER} /opt/app/aaf_config; fi CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"] -CMD [] diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core index 3e87ca56..f74e9fbd 100644 --- a/auth/docker/Dockerfile.core +++ b/auth/docker/Dockerfile.core @@ -30,5 +30,5 @@ COPY lib /opt/app/aaf/lib COPY bin /opt/app/aaf/bin COPY theme /opt/app/aaf/theme -RUN chown -R ${USER}:${USER} /opt/app/aaf +RUN if [ -n "${DUSER}" ]; then chown -R ${DUSER}:${DUSER} /opt/app/aaf; fi diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms index d5614316..ead958b3 100644 --- a/auth/docker/Dockerfile.ms +++ b/auth/docker/Dockerfile.ms @@ -25,9 +25,11 @@ LABEL description="aaf_${AAF_COMPONENT}" LABEL version=${AAF_VERSION} COPY bin/pod_wait.sh /opt/app/aaf/bin/ -RUN mkdir -p /opt/app/osaaf && chown ${USER}:${USER} /opt/app/osaaf -RUN mkdir -p /opt/app/aaf/status && chown ${USER}:${USER} /opt/app/aaf/status -RUN chown -R ${USER}:${USER} /opt/app/aaf +RUN mkdir -p /opt/app/osaaf +RUN mkdir -p /opt/app/aaf/status +RUN if [ -n "${DUSER}" ]; then chown ${DUSER}:${DUSER} /opt/app/aaf/status \ + && chown ${DUSER}:${DUSER} /opt/app/osaaf \ + && chown -R ${DUSER}:${DUSER} /opt/app/aaf; fi #CMD ["bash","-c","cd /opt/app/aaf;bin/${AAF_COMPONENT}"] CMD [] diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh index ac888390..02d258f8 100644 --- a/auth/docker/aaf.sh +++ b/auth/docker/aaf.sh @@ -26,8 +26,11 @@ DOCKER=${DOCKER:=docker} LINKS="--link $CASSANDRA_DOCKER" function run_it() { + if [ -n "${DUSER}" ]; then + USER_LINE="--user ${DUSER}" + fi $DOCKER run $@ \ - --user aaf \ + $USER_LINE \ -v "aaf_config:$CONF_ROOT_DIR" \ -v "aaf_status:/opt/app/aaf/status" \ $LINKS \ diff --git a/auth/docker/agent.sh b/auth/docker/agent.sh index 86fee5f6..a2b11830 100644 --- a/auth/docker/agent.sh +++ b/auth/docker/agent.sh @@ -90,11 +90,16 @@ else PREFIX="" fi -$DOCKER run \ - -it \ - --rm \ +function run_it() { + LINKS="--link aaf-locate" + if [ -n "${DUSER}" ]; then + USER_LINE="--user ${DUSER}" + fi + $DOCKER run -it --rm \ + ${USER_LINE} \ -v "${VOLUME}:/opt/app/osaaf" \ --add-host="$AAF_FQDN:$AAF_FQDN_IP" \ + $LINKS \ --env AAF_FQDN=${AAF_FQDN} \ --env DEPLOY_FQI=${DEPLOY_FQI} \ --env DEPLOY_PASSWORD=${DEPLOY_PASSWORD} \ @@ -102,6 +107,19 @@ $DOCKER run \ --env APP_FQDN=${APP_FQDN} \ --env LATITUDE=${LATITUDE} \ --env LONGITUDE=${LONGITUDE} \ - --name aaf_agent_$USER \ + --name aaf-agent-$USER \ "$PREFIX"onap/aaf/aaf_agent:$VERSION \ - /bin/bash "$@" + bash -c "bash /opt/app/aaf_config/bin/agent.sh $PARAMS" +} + +PARAMS=$@ +case "$1" in + bash) + PARAMS="&& cd /opt/app/osaaf/local && exec bash" + run_it -it --rm + ;; + *) + run_it --rm + ;; +esac + diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh index f9ff9b3b..3f9bfdaf 100755 --- a/auth/docker/dbuild.sh +++ b/auth/docker/dbuild.sh @@ -38,7 +38,7 @@ cd - # AAF Base version - set the core image, etc sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ Dockerfile.base > Dockerfile $DOCKER build -t ${ORG}/${PROJECT}/aaf_base:${VERSION} . $DOCKER tag ${ORG}/${PROJECT}/aaf_base:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_base:${VERSION} @@ -56,7 +56,7 @@ cp -Rf ../conf/CA sample sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ docker/Dockerfile.config > sample/Dockerfile $DOCKER build -t ${ORG}/${PROJECT}/aaf_config:${VERSION} sample $DOCKER tag ${ORG}/${PROJECT}/aaf_config:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_config:${VERSION} @@ -67,7 +67,7 @@ cp ../cadi/servlet-sample/target/aaf-cadi-servlet-sample-${VERSION}-sample.jar s sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ docker/Dockerfile.client > sample/Dockerfile $DOCKER build -t ${ORG}/${PROJECT}/aaf_agent:${VERSION} sample $DOCKER tag ${ORG}/${PROJECT}/aaf_agent:${VERSION} ${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/aaf_agent:${VERSION} @@ -85,7 +85,7 @@ echo Building aaf_$AAF_COMPONENT... sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ Dockerfile.core >../aaf_${VERSION}/Dockerfile cd .. $DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION} @@ -109,7 +109,7 @@ for AAF_COMPONENT in ${AAF_COMPONENTS}; do sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \ -e 's/${AAF_COMPONENT}/'${AAF_COMPONENT}'/g' \ -e 's/${DOCKER_REPOSITORY}/'${DOCKER_REPOSITORY}'/g' \ - -e 's/${USER}/'${USER}'/g' \ + -e 's/${DUSER}/'${DUSER}'/g' \ Dockerfile.ms >../aaf_${VERSION}/Dockerfile cd .. $DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION} |