Revert the changes for Docker non root user
There are side effects when using non root user in Dockerfile(s)
Need further investigation
Signed-off-by: ecaiyanlinux <martin.c.yan@est.tech>
Change-Id: Idc8d45084d9bee28f52c5e236b652d3f4d497d7a
diff --git a/a1-policy-management-service/Dockerfile b/a1-policy-management-service/Dockerfile
index 3775b39..f64eebb 100644
--- a/a1-policy-management-service/Dockerfile
+++ b/a1-policy-management-service/Dockerfile
@@ -34,11 +34,8 @@
ADD /config/keystore.jks /opt/app/policy-agent/etc/cert/keystore.jks
ADD /config/truststore.jks /opt/app/policy-agent/etc/cert/truststore.jks
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-RUN chown -R appuser:appuser /opt/app/policy-agent
-RUN chown -R appuser:appuser /var/log/policy-agent
-USER appuser
+RUN chmod -R 777 /opt/app/policy-agent/config/
+RUN chmod -R 777 /opt/app/policy-agent/data/
ADD target/${JAR} /opt/app/policy-agent/policy-agent.jar
CMD ["java", "-jar", "/opt/app/policy-agent/policy-agent.jar"]
diff --git a/dmaap-adaptor-java/Dockerfile b/dmaap-adaptor-java/Dockerfile
index 9843699..b2c0c30 100644
--- a/dmaap-adaptor-java/Dockerfile
+++ b/dmaap-adaptor-java/Dockerfile
@@ -30,18 +30,14 @@
RUN mkdir -p /var/log/dmaap-adaptor-service
RUN mkdir -p /opt/app/dmaap-adaptor-service/etc/cert/
RUN mkdir -p /var/dmaap-adaptor-service
+RUN chmod -R 777 /var/dmaap-adaptor-service
ADD /config/application.yaml /opt/app/dmaap-adaptor-service/config/application.yaml
ADD /config/application_configuration.json /opt/app/dmaap-adaptor-service/data/application_configuration.json_example
ADD /config/keystore.jks /opt/app/dmaap-adaptor-service/etc/cert/keystore.jks
ADD /config/truststore.jks /opt/app/dmaap-adaptor-service/etc/cert/truststore.jks
-
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-RUN chown -R appuser:appuser /var/dmaap-adaptor-service/
-RUN chown -R appuser:appuser /opt/app/dmaap-adaptor-service/
-USER appuser
+RUN chmod -R 777 /opt/app/dmaap-adaptor-service/config/
ADD target/${JAR} /opt/app/dmaap-adaptor-service/dmaap-adaptor.jar
CMD ["java", "-jar", "/opt/app/dmaap-adaptor-service/dmaap-adaptor.jar"]
diff --git a/information-coordinator-service/Dockerfile b/information-coordinator-service/Dockerfile
index 226d2ec..e9d179d 100644
--- a/information-coordinator-service/Dockerfile
+++ b/information-coordinator-service/Dockerfile
@@ -25,6 +25,7 @@
RUN mkdir -p /var/log/information-coordinator-service
RUN mkdir -p /opt/app/information-coordinator-service/etc/cert/
RUN mkdir -p /var/information-coordinator-service
+RUN chmod -R 777 /var/information-coordinator-service
EXPOSE 8083 8434
@@ -33,12 +34,8 @@
ADD /config/keystore.jks /opt/app/information-coordinator-service/etc/cert/keystore.jks
ADD /config/truststore.jks /opt/app/information-coordinator-service/etc/cert/truststore.jks
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-RUN chown -R appuser:appuser /opt/app/information-coordinator-service
-RUN chown -R appuser:appuser /var/information-coordinator-service
-RUN chown -R appuser:appuser /var/log/information-coordinator-service
-USER appuser
+
+RUN chmod -R 777 /opt/app/information-coordinator-service/config/
CMD ["java", "-jar", "/opt/app/information-coordinator-service/information-coordinator-service.jar"]
diff --git a/r-app-catalogue/Dockerfile b/r-app-catalogue/Dockerfile
index 474a3ce..cd2efc9 100644
--- a/r-app-catalogue/Dockerfile
+++ b/r-app-catalogue/Dockerfile
@@ -27,16 +27,13 @@
EXPOSE 8680 8633
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-RUN chown -R appuser:appuser /opt/app/r-app-catalogue/
-RUN chown -R appuser:appuser /var/log/r-app-catalogue/
-USER appuser
-
ADD /config/application.yaml /opt/app/r-app-catalogue/config/application.yaml
ADD /config/r-app-catalogue-keystore.jks /opt/app/r-app-catalogue/etc/cert/keystore.jks
ADD target/${JAR} /opt/app/r-app-catalogue/r-app-catalogue.jar
+
+RUN chmod -R 777 /opt/app/r-app-catalogue/config/
+
CMD ["java", "-jar", "/opt/app/r-app-catalogue/r-app-catalogue.jar"]
diff --git a/test/cr/Dockerfile b/test/cr/Dockerfile
index 92efcb0..e66d30f 100644
--- a/test/cr/Dockerfile
+++ b/test/cr/Dockerfile
@@ -31,17 +31,4 @@
RUN chmod +x start.sh
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-
-## add permissions for appuser user
-RUN chown -R appuser:appuser /usr/src/app/ && chmod -R 755 /usr/src/app/ && \
- chown -R appuser:appuser /var/log/nginx && \
- chown -R appuser:appuser /var/lib/nginx && \
- chown -R appuser:appuser /etc/nginx/conf.d
-RUN touch /var/run/nginx.pid && \
- chown -R appuser:appuser /var/run/nginx.pid
-
-USER appuser
-
CMD [ "./start.sh" ]
diff --git a/test/cr/app/nginx.conf b/test/cr/app/nginx.conf
index 31e3845..32beca1 100644
--- a/test/cr/app/nginx.conf
+++ b/test/cr/app/nginx.conf
@@ -1,4 +1,4 @@
-# user www-data;
+user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
diff --git a/test/http-https-proxy/Dockerfile b/test/http-https-proxy/Dockerfile
index 0043eeb..d7a78ad 100644
--- a/test/http-https-proxy/Dockerfile
+++ b/test/http-https-proxy/Dockerfile
@@ -13,6 +13,4 @@
WORKDIR /usr/src/app
COPY http_proxy.js .
-USER node
-
CMD [ "node", "http_proxy.js" ]
\ No newline at end of file
diff --git a/test/mrstub/Dockerfile b/test/mrstub/Dockerfile
index 9b58a99..676c77c 100644
--- a/test/mrstub/Dockerfile
+++ b/test/mrstub/Dockerfile
@@ -34,16 +34,4 @@
RUN chmod +x start.sh
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-## add permissions for appuser user
-RUN chown -R appuser:appuser /usr/src/app/ && chmod -R 755 /usr/src/app/ && \
- chown -R appuser:appuser /var/log/nginx && \
- chown -R appuser:appuser /var/lib/nginx && \
- chown -R appuser:appuser /etc/nginx/conf.d
-RUN touch /var/run/nginx.pid && \
- chown -R appuser:appuser /var/run/nginx.pid
-
-USER appuser
-
CMD [ "./start.sh" ]
\ No newline at end of file
diff --git a/test/mrstub/app/nginx.conf b/test/mrstub/app/nginx.conf
index be342b1..35b5ba0 100644
--- a/test/mrstub/app/nginx.conf
+++ b/test/mrstub/app/nginx.conf
@@ -1,4 +1,4 @@
-# user www-data;
+user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
diff --git a/test/prodstub/Dockerfile b/test/prodstub/Dockerfile
index 813cfbd..4768bf9 100644
--- a/test/prodstub/Dockerfile
+++ b/test/prodstub/Dockerfile
@@ -32,17 +32,4 @@
RUN apt-get update
RUN apt-get install -y nginx=1.14.*
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-
-## add permissions for appuser user
-RUN chown -R appuser:appuser /usr/src/app/ && chmod -R 755 /usr/src/app/ && \
- chown -R appuser:appuser /var/log/nginx && \
- chown -R appuser:appuser /var/lib/nginx && \
- chown -R appuser:appuser /etc/nginx/conf.d
-RUN touch /var/run/nginx.pid && \
- chown -R appuser:appuser /var/run/nginx.pid
-
-USER appuser
-
CMD [ "./start.sh" ]
diff --git a/test/prodstub/app/nginx.conf b/test/prodstub/app/nginx.conf
index 5ff404b..8119b0d 100644
--- a/test/prodstub/app/nginx.conf
+++ b/test/prodstub/app/nginx.conf
@@ -1,4 +1,4 @@
-# user www-data;
+user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/app/Dockerfile b/test/usecases/oruclosedlooprecovery/scriptversion/app/Dockerfile
index 3c1a064..4cb03c7 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/app/Dockerfile
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/app/Dockerfile
@@ -29,8 +29,4 @@
RUN pip install -r requirements.txt
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-USER appuser
-
CMD [ "python3", "-u", "main.py" ]
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-message-generator b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-message-generator
index bb9c014..841cf7f 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-message-generator
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-message-generator
@@ -29,9 +29,4 @@
RUN pip install -r requirements.txt
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-
-USER appuser
-
CMD [ "python3", "-u", "message_generator.py" ]
diff --git a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-sdnr-sim b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-sdnr-sim
index f3a5200..4275b17 100644
--- a/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-sdnr-sim
+++ b/test/usecases/oruclosedlooprecovery/scriptversion/simulators/Dockerfile-sdnr-sim
@@ -29,9 +29,4 @@
RUN pip install -r requirements.txt
-RUN groupadd -g 999 appuser && \
- useradd -r -u 999 -g appuser appuser
-
-USER appuser
-
CMD [ "python3", "-u", "sdnr_simulator.py" ]