From bcc754b16ceb6fe2ca4c4ea4c1f4f24662d440a3 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 11 Apr 2018 14:54:40 +0530 Subject: Docker file env rearrange to one execution Issue-ID: CLI-81 Change-Id: Ic476745deba6eccfbf0e5cc671fb4aeece0cd17e Signed-off-by: Kanagaraj Manickam k00365106 --- deployment/docker/src/main/docker/Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile index a01449d7..729366fb 100644 --- a/deployment/docker/src/main/docker/Dockerfile +++ b/deployment/docker/src/main/docker/Dockerfile @@ -10,13 +10,12 @@ RUN cd /tmp && curl -O https://storage.googleapis.com/golang/go1.9.linux-amd64.t mv /tmp/gotty/bin/gotty /usr/sbin/ #Environments -ENV OPEN_CLI_HOME /opt/oclip -ENV OPEN_CLI_DEBUG false -ENV OPEN_CLI_DEBUG_PORT 5005 -ENV OPEN_CLI_MODE console -ENV OPEN_CLI_PRODUCT_IN_USE open-cli - -ENV GOTTY_TITLE_FORMAT {{ .command }} +ENV OPEN_CLI_HOME=/opt/oclip \ + OPEN_CLI_DEBUG=false \ + OPEN_CLI_DEBUG_PORT=5005 \ + OPEN_CLI_MODE=console \ + OPEN_CLI_PRODUCT_IN_USE=open-cli \ + GOTTY_TITLE_FORMAT="{{ .command }}" #Copy CLI into docker ADD ./STAGE $OPEN_CLI_HOME -- cgit 1.2.3-korg From 1316fae7571a8d8d269032dfb1ba1e158d3cb53c Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 11 Apr 2018 14:58:25 +0530 Subject: Docker: Combile all RUN into one sequence Issue-ID: CLI-81 Change-Id: I4e185bc406b7a1d52b50a024c24aa7782c932e62 Signed-off-by: Kanagaraj Manickam k00365106 --- deployment/docker/src/main/docker/Dockerfile | 39 ++++++++++------------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile index 729366fb..91ab0ed4 100644 --- a/deployment/docker/src/main/docker/Dockerfile +++ b/deployment/docker/src/main/docker/Dockerfile @@ -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 !! -- cgit 1.2.3-korg From 360ebdc33360296f7bff7df97fe45e8265454cea Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 11 Apr 2018 15:01:06 +0530 Subject: Docker: Add COPY as part of RUN to improve layers Issue-ID: CLI-81 Change-Id: Ia852017c022be86af93754fd940f4bfd64ff0139 Signed-off-by: Kanagaraj Manickam k00365106 --- deployment/docker/src/main/docker/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile index 91ab0ed4..b343b966 100644 --- a/deployment/docker/src/main/docker/Dockerfile +++ b/deployment/docker/src/main/docker/Dockerfile @@ -24,13 +24,13 @@ RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \ 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 -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 + if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi&& \ + cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ && \ + cp $OPEN_CLI_HOME/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf && \ + if [ ! -d /var/www-data/servers/open-cli/ ]; then mkdir -p /var/www-data/servers/open-cli/; fi && \ + cp $OPEN_CLI_HOME/http/web/*.* /var/www-data/servers/open-cli/ && \ + cp $OPEN_CLI_HOME/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/ && \ + cp $OPEN_CLI_HOME/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip EXPOSE 80 -- cgit 1.2.3-korg From 7e8d64ca08f544da2f2755290dd4725f442bcda9 Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Wed, 11 Apr 2018 15:02:41 +0530 Subject: Docker: Strip off unwanted comments Issue-ID: CLI-81 Change-Id: Ia439a8b7c0aa1d6c8688136b7077d8b2c97eb941 Signed-off-by: Kanagaraj Manickam k00365106 --- deployment/docker/src/main/docker/Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/deployment/docker/src/main/docker/Dockerfile b/deployment/docker/src/main/docker/Dockerfile index b343b966..074bb164 100644 --- a/deployment/docker/src/main/docker/Dockerfile +++ b/deployment/docker/src/main/docker/Dockerfile @@ -1,6 +1,5 @@ FROM openjdk:8-jre-slim -#Environments ENV OPEN_CLI_HOME=/opt/oclip \ OPEN_CLI_DEBUG=false \ OPEN_CLI_DEBUG_PORT=5005 \ @@ -8,7 +7,6 @@ ENV OPEN_CLI_HOME=/opt/oclip \ OPEN_CLI_PRODUCT_IN_USE=open-cli \ GOTTY_TITLE_FORMAT="{{ .command }}" -#Copy CLI into docker ADD ./STAGE $OPEN_CLI_HOME WORKDIR $OPEN_CLI_HOME @@ -24,7 +22,7 @@ RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \ 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&& \ + if [ ! -f /var/log/lighttpd/access.log ]; then touch /var/log/lighttpd/access.log; fi && \ cp /etc/lighttpd/conf-available/10-accesslog.conf /etc/lighttpd/conf-enabled/ && \ cp $OPEN_CLI_HOME/http/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf && \ if [ ! -d /var/www-data/servers/open-cli/ ]; then mkdir -p /var/www-data/servers/open-cli/; fi && \ @@ -32,10 +30,8 @@ RUN apt-get update && apt-get install -y lighttpd git curl pandoc vim && \ cp $OPEN_CLI_HOME/http/lighttpd/10-proxy.conf /etc/lighttpd/conf-enabled/ && \ cp $OPEN_CLI_HOME/installer/cli-*.zip /var/www-data/servers/open-cli/oclip.zip -EXPOSE 80 -#RTE: gotty +EXPOSE 80 EXPOSE 8080 -#Start ENTRYPOINT if [ "$OPEN_CLI_MODE" = "daemon" ]; then service lighttpd start; gotty --permit-write --reconnect oclip; else oclip -v && /bin/bash; fi -- cgit 1.2.3-korg