[AAI-2175] Change aai champ container processes to run as non-root on the host
[aai/champ.git] / champ-service / src / main / docker / Dockerfile
1 FROM @aai.docker.namespace@/aai-common-@aai.base.image@:@aai.base.image.version@
2
3 ARG MICRO_HOME=/opt/app/champ-service
4 ARG BIN_HOME=$MICRO_HOME/bin
5 ARG GRAPHLIB_HOME=$MICRO_HOME/graph-deps
6 #AAI-2175 Additional optional steps for Ubuntu
7 RUN if  ((uname -v | grep -i "ubuntu") || ( cat /etc/*release|grep -i "ubuntu")      ) ; then \
8    #####################################
9    #if JAVA doesnt exist then install it:
10    ######################################
11    if type  java  2>/dev/null; then \
12      echo "skipping java installation"; \
13    else \
14      apt-get update && apt-get install -y software-properties-common; \
15      ## sudo -E is required to preserve the environment. If you remove that line, it will most like freeze at this step
16      sudo -E add-apt-repository ppa:openjdk-r/ppa && apt-get update && apt-get install -y openjdk-8-jdk ; \
17      ## Setup JAVA_HOME, this is useful for docker commandline
18      JAVA_HOME=usr/lib/jvm/java-8-openjdk-amd64; \
19      export JAVA_HOME ; \
20    fi; \
21    ##########################################
22    #Install gosu if not present
23    ##########################################
24    if type  gosu   2>/dev/null; then \
25      echo "skipping gosu installation"; \
26    else \
27      set -x ; \
28      add-apt-repository -y ppa:tianon/gosu; \
29      sudo apt-get update; \
30      sudo apt-get install gosu; \
31    fi;\
32 fi
33
34 # Build up the deployment folder structure
35 RUN mkdir -p $MICRO_HOME
36 WORKDIR $MICRO_HOME
37 COPY /maven/champ-service/ .
38 RUN chmod 755 $BIN_HOME/* \
39     && ln -snf /logs $MICRO_HOME/logs
40
41 EXPOSE 9522 9522
42
43 CMD ["/opt/app/champ-service/bin/start.sh"]