Refine properties for non-root
Issue-ID: AAF-698
Change-Id: I266f0e36842fb506dbb3e412e12eedf64e24418a
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/docker/Dockerfile.base b/auth/docker/Dockerfile.base
index 1d74362..879c319 100644
--- a/auth/docker/Dockerfile.base
+++ b/auth/docker/Dockerfile.base
@@ -23,5 +23,5 @@
LABEL description="aaf_base"
RUN apk add --no-cache bash
RUN apk add --no-cache openssl
-RUN addgroup aaf && adduser aaf -G aaf -D -s /bin/bash
+RUN addgroup ${USER} && adduser ${USER} -G ${USER} -D -s /bin/bash
diff --git a/auth/docker/Dockerfile.client b/auth/docker/Dockerfile.client
index f662aac..d0c2057 100644
--- a/auth/docker/Dockerfile.client
+++ b/auth/docker/Dockerfile.client
@@ -31,6 +31,6 @@
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 aaf:aaf /opt/app/aaf_config
+RUN chown -R ${USER}:${USER} /opt/app/aaf_config
CMD ["/bin/bash","-c","/opt/app/aaf_config/bin/agent.sh"]
diff --git a/auth/docker/Dockerfile.config b/auth/docker/Dockerfile.config
index ca3df76..a6d6d4f 100644
--- a/auth/docker/Dockerfile.config
+++ b/auth/docker/Dockerfile.config
@@ -37,7 +37,8 @@
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 aaf:aaf /opt/app/aaf_config && mkdir /opt/app/osaaf && chown aaf:aaf /opt/app/osaaf
+RUN chown -R ${USER}:${USER} /opt/app/aaf_config
+RUN mkdir -p /opt/app/osaaf && chown ${USER}:${USER} /opt/app/osaaf
CMD ["/bin/bash","/opt/app/aaf_config/bin/agent.sh"]
CMD []
diff --git a/auth/docker/Dockerfile.core b/auth/docker/Dockerfile.core
index 7237a00..3e87ca5 100644
--- a/auth/docker/Dockerfile.core
+++ b/auth/docker/Dockerfile.core
@@ -30,5 +30,5 @@
COPY bin /opt/app/aaf/bin
COPY theme /opt/app/aaf/theme
-RUN chown -R aaf:aaf /opt/app/aaf
+RUN chown -R ${USER}:${USER} /opt/app/aaf
diff --git a/auth/docker/Dockerfile.ms b/auth/docker/Dockerfile.ms
index 222816c..d561431 100644
--- a/auth/docker/Dockerfile.ms
+++ b/auth/docker/Dockerfile.ms
@@ -25,7 +25,9 @@
LABEL version=${AAF_VERSION}
COPY bin/pod_wait.sh /opt/app/aaf/bin/
-RUN mkdir /opt/app/osaaf && chown aaf:aaf /opt/app/osaaf && chown -R aaf:aaf /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
#CMD ["bash","-c","cd /opt/app/aaf;bin/${AAF_COMPONENT}"]
CMD []
diff --git a/auth/docker/aaf.sh b/auth/docker/aaf.sh
index a039be8..ac88839 100644
--- a/auth/docker/aaf.sh
+++ b/auth/docker/aaf.sh
@@ -32,9 +32,10 @@
-v "aaf_status:/opt/app/aaf/status" \
$LINKS \
--env aaf_locator_container=docker \
+ --env aaf_locator_container_ns=${NAMESPACE} \
--env aaf_locator_fqdn=${HOSTNAME} \
--env aaf_locate_url=https://aaf-locate:8095 \
- --env aaf_locator_public_hostname=$HOSTNAME \
+ --env aaf_locator_public_hostname=${HOSTNAME} \
--env AAF_ENV=${AAF_ENV} \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
diff --git a/auth/docker/dbuild.sh b/auth/docker/dbuild.sh
index fd59ed4..f9ff9b3 100755
--- a/auth/docker/dbuild.sh
+++ b/auth/docker/dbuild.sh
@@ -38,6 +38,7 @@
# AAF Base version - set the core image, etc
sed -e 's/${AAF_VERSION}/'${VERSION}'/g' \
+ -e 's/${USER}/'${USER}'/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}
@@ -55,6 +56,7 @@
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' \
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}
@@ -65,6 +67,7 @@
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' \
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}
@@ -82,6 +85,7 @@
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' \
Dockerfile.core >../aaf_${VERSION}/Dockerfile
cd ..
$DOCKER build -t ${ORG}/${PROJECT}/aaf_core:${VERSION} aaf_${VERSION}
@@ -105,6 +109,7 @@
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' \
Dockerfile.ms >../aaf_${VERSION}/Dockerfile
cd ..
$DOCKER build -t ${ORG}/${PROJECT}/aaf_${AAF_COMPONENT}:${VERSION} aaf_${VERSION}
diff --git a/auth/docker/drun.sh b/auth/docker/drun.sh
index 6fc3a9a..d7d43d6 100644
--- a/auth/docker/drun.sh
+++ b/auth/docker/drun.sh
@@ -91,6 +91,7 @@
#ADD_HOST="$ADD_HOST --add-host=$CASS_HOST"
#fi
#--hostname="${AAF_COMPONENT}.${NAMESPACE}" \
+ # --env aaf_locate_url=https://aaf-locate:8095 \
# $ADD_HOST \
$DOCKER run \
-d \
@@ -99,7 +100,9 @@
${LINKS} \
--env AAF_ENV=${AAF_ENV} \
--env aaf_locator_container=docker \
- --env aaf_locator_fqdn=$HOSTNAME \
+ --env aaf_locator_container_ns=${NAMESPACE} \
+ --env aaf_locator_fqdn=${HOSTNAME} \
+ --env aaf_locator_public_hostname=${HOSTNAME} \
--env LATITUDE=${LATITUDE} \
--env LONGITUDE=${LONGITUDE} \
--env CASSANDRA_CLUSTER=${CASSANDRA_CLUSTER} \