IOT-3244 configurable JMX_HOSTNAME
[iotivity.git] / cloud / resourcedirectory / Dockerfile
index 1fddd08..0e3cfb3 100644 (file)
@@ -2,10 +2,14 @@ FROM openjdk:8-jre-alpine
 
 RUN apk add --update \
     curl \
+    shadow \
     && rm -rf /var/cache/apk/*
 
-ADD ./target/CloudResourceDirectory-0.0.1-SNAPSHOT.jar iotivity/ResourceDirectory.jar
-ADD ./target/lib/* iotivity/lib/
+RUN groupadd -r iotivity && useradd --no-log-init --system  -g iotivity iotivity
+
+COPY --chown=iotivity:iotivity ./target/CloudResourceDirectory-0.0.1-SNAPSHOT.jar iotivity/ResourceDirectory.jar
+COPY --chown=iotivity:iotivity ./target/lib/* iotivity/lib/
+COPY --chown=iotivity:iotivity ./start.sh iotivity/
 
 WORKDIR iotivity/
 
@@ -16,17 +20,11 @@ ENV MONGODB_ADDRESS mongodb
 ENV MONGODB_PORT 27017
 
 ENV JMX_PORT 9004
-ENV JAVA_JMX_OPTS "-Dcom.sun.management.jmxremote \
-               -Dcom.sun.management.jmxremote.port=${JMX_PORT} \
-               -Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT} \
-               -Dcom.sun.management.jmxremote.local.only=false \
-               -Dcom.sun.management.jmxremote.authenticate=false \
-               -Dcom.sun.management.jmxremote.ssl=false \
-               -Djava.rmi.server.hostname= \
-               -XX:MetaspaceSize=20m -XX:MaxMetaspaceSize=25m \
-               -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -server "
+ENV JMX_HOSTNAME ""
+ENV JAVA_MEMORY_OPTS ""
 
 EXPOSE 9004
 
-ENTRYPOINT exec java $JAVA_JMX_OPTS $JAVA_MEMORY_OPTS -jar ResourceDirectory.jar
-HEALTHCHECK --interval=30s --timeout=2s --retries=3    CMD curl -f http://localhost/api/healthcheck || exit 1
+USER iotivity
+ENTRYPOINT [ "./start.sh" ]
+HEALTHCHECK --interval=30s --timeout=2s --retries=3    CMD curl -f http://localhost:8000/api/healthcheck || exit 1
\ No newline at end of file