Docker: Combile all RUN into one sequence 19/42219/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Wed, 11 Apr 2018 09:28:25 +0000 (14:58 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Wed, 11 Apr 2018 09:30:20 +0000 (15:00 +0530)
Issue-ID: CLI-81

Change-Id: I4e185bc406b7a1d52b50a024c24aa7782c932e62
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
deployment/docker/src/main/docker/Dockerfile

index 729366f..91ab0ed 100644 (file)
@@ -1,14 +1,5 @@
 FROM openjdk:8-jre-slim
 
-#Setup default software
-RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim
-
-#Setup gotty
-RUN cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && \
-    tar -xvf go1.9.linux-amd64.tar.gz && mkdir -p /tmp/gotty && \
-    GOPATH=/tmp/gotty /tmp/go/bin/go get github.com/yudai/gotty && \
-    mv /tmp/gotty/bin/gotty /usr/sbin/
-
 #Environments
 ENV OPEN_CLI_HOME=/opt/oclip \
     OPEN_CLI_DEBUG=false \
@@ -21,15 +12,19 @@ ENV OPEN_CLI_HOME=/opt/oclip \
 ADD ./STAGE $OPEN_CLI_HOME
 WORKDIR $OPEN_CLI_HOME
 
-#Setup the run time environment (RTE)
-#RTE: CLI
-RUN chmod +x ./bin/oclip.sh  && \
-     ln ./bin/oclip.sh /usr/sbin/oclip  && \
-     if [ ! -d ./data ]; then mkdir ./data; fi  && \
-     if [ ! -d ./open-cli-schema ]; then mkdir ./open-cli-schema; fi
-
-#Create the readable README
-RUN pandoc -t plain $OPEN_CLI_HOME/docs/README.md > $OPEN_CLI_HOME/docs/oclip-readme.txt
+RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \
+    cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz && \
+    tar -xvf go1.9.linux-amd64.tar.gz && mkdir -p /tmp/gotty && \
+    GOPATH=/tmp/gotty /tmp/go/bin/go get github.com/yudai/gotty && \
+    mv /tmp/gotty/bin/gotty /usr/sbin/ && \
+    pandoc -t plain $OPEN_CLI_HOME/docs/README.md > $OPEN_CLI_HOME/docs/oclip-readme.txt && \
+    apt-get purge -y pandoc && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/go /tmp/gotty /tmp/* /var/tmp/* && \
+    chmod +x  $OPEN_CLI_HOME/bin/oclip.sh  && \
+    ln  $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/oclip  && \
+    ln  $OPEN_CLI_HOME/bin/oclip.sh /usr/sbin/onap  && \
+    if [ ! -d  $OPEN_CLI_HOME/data ]; then mkdir  $OPEN_CLI_HOME/data; fi  && \
+    if [ ! -d  $OPEN_CLI_HOME/open-cli-schema ]; then mkdir  $OPEN_CLI_HOME/open-cli-schema; fi && \
+    if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi
 
 #RTE: lighttpd
 COPY ./STAGE/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf
@@ -37,9 +32,6 @@ COPY ./STAGE/http/web /var/www-data/servers/open-cli/
 COPY ./STAGE/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/
 COPY ./STAGE/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip
 
-RUN if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi
-RUN cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/
-
 EXPOSE 80
 
 #RTE: gotty
@@ -47,8 +39,3 @@ EXPOSE 8080
 
 #Start
 ENTRYPOINT if [ "$OPEN_CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect oclip; else oclip -v && /bin/bash; fi
-
-#Cleanup
-RUN apt-get purge -y pandoc && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/go /tmp/gotty /tmp/* /var/tmp/*
-
-RUN echo Open CLI docker successfully created !!