From d2802fbc8b27bd64abc36afd81f1fe27d2a4ea77 Mon Sep 17 00:00:00 2001 From: Avinash S Date: Thu, 22 Feb 2018 09:53:38 +0000 Subject: Migrate container to ubuntu 16.04 Change-Id: Ia4bc11843e3fb43722f50472213272abffe3c9b1 Issue-ID: VNFSDK-211 Signed-off-by: Avinash S --- .../docker-refrepo/src/main/docker/Dockerfile | 128 ++++++++++++++------- .../docker-refrepo/src/main/docker/certgen.sh | 4 +- 2 files changed, 89 insertions(+), 43 deletions(-) (limited to 'vnfmarket-be') diff --git a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/Dockerfile b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/Dockerfile index 35657181..12b354bc 100644 --- a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/Dockerfile +++ b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/Dockerfile @@ -6,60 +6,96 @@ # 10-basebuild.txt -FROM centos:7 +FROM ubuntu:16.04 +#RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections +RUN apt-get install -y +RUN apt-get update -y +RUN apt-get install wget -y -RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf -RUN sed -i 's|#baseurl=http://mirror.centos.org/centos|baseurl=http://mirrors.ocf.berkeley.edu/centos|' /etc/yum.repos.d/*.repo -RUN yum update -y +WORKDIR /service -RUN yum install -y wget unzip socat java-1.8.0-openjdk-headless -RUN sed -i 's|#networkaddress.cache.ttl=-1|networkaddress.cache.ttl=10|' /usr/lib/jvm/jre/lib/security/java.security -ENV JAVA_HOME /usr/lib/jvm/jre -WORKDIR /service -# 20-mysq.txt -RUN yum -y install epel-release -RUN yum -y install nginx && \ - mkdir -p /etc/nginx/ssl -COPY nginx.conf /etc/nginx/nginx.conf -COPY certgen.sh . -CMD chmod +x ./certgen.sh -RUN ./certgen.sh -# && systemctl start nginx - -# Set up mysql -RUN wget -q http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm && rpm -ivh mysql-community-release-el7-5.noarch.rpm && rm -f mysql-community-release-el7-5.noarch.rpm -RUN yum -y update -RUN yum -y install -y mysql-server -RUN mysql_install_db --user=mysql --datadir=/var/lib/mysql -COPY init-mysql.sh . - -# 30-tomcat.txt - AUTOGENERATED, DO NOT MODIFY MANUALLY +ENV JAVA_VERSION_MAJOR=8 \ + JAVA_VERSION_MINOR=111 \ + JAVA_HOME=/usr/lib/jvm/default-jvm \ + PATH=${PATH}:/usr/lib/jvm/default-jvm/bin/ + +RUN DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install python-software-properties +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common + +RUN add-apt-repository ppa:openjdk-r/ppa -y && \ + + # update data from repositories + apt-get update && \ + + # upgrade OS + apt-get -y dist-upgrade && \ + + # Make info file about this build + printf "Build of java:openjdk-8-jre-headless, date: %s\n" `date -u +"%Y-%m-%dT%H:%M:%SZ"` > /service/java && \ + + # install application + apt-get install -y --no-install-recommends openjdk-8-jre-headless && \ + + # fix default setting + ln -s java-8-openjdk-amd64 /usr/lib/jvm/default-jvm && \ + + # remove apt cache from image + apt-get clean all + + # Set up tomcat RUN wget -q http://mirrors.ocf.berkeley.edu/apache/tomcat/tomcat-8/v8.0.50/bin/apache-tomcat-8.0.50.tar.gz && tar --strip-components=1 -xf apache-tomcat-8.0.50.tar.gz && rm -f apache-tomcat-8.0.50.tar.gz && rm -rf webapps && mkdir -p webapps/ROOT RUN echo 'export CATALINA_OPTS="$CATALINA_OPTS -Xms64m -Xmx256m -XX:MaxPermSize=64m"' > /service/bin/setenv.sh ENV CATALINA_HOME /service -# 50-microservice.txt - AUTOGENERATED, DO NOT MODIFY MANUALLY - # Set up microservice -ADD ./STAGE /service -RUN yum install -y gcc-c++ make && curl -sL https://rpm.nodesource.com/setup_6.x | bash - -RUN yum install -y nodejs -RUN cd /service/webapps/onapui/vnfmarket && npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && npm install +#ADD ./STAGE /service +#RUN apt-get install -y g++ make && curl -sL https://rpm.nodesource.com/setup_6.x | bash - +#RUN apt-get install -y nodejs +#RUN apt-get install -y npm +#RUN cd /service/webapps/onapui/vnfmarket && npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && npm install + + + +RUN add-apt-repository -y ppa:nginx/stable && \ + apt-get update && \ + apt-get install -y nginx && \ + rm -rf /var/lib/apt/lists/* && \ + echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \ + chown -R www-data:www-data /var/lib/nginx + +# Define mountable directories. +VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"] + +# Define working directory. +WORKDIR /etc/nginx + +#CMD ["nginx"] + -# https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vnfsdk.refrepo.marketplace&a=vnf-sdk-marketplace-deployment&e=zip&c=&v=LATEST -# RUN wget -q -O vnf-sdk-marketplace-1.0.0.zip "https://nexus.onap.org/service/local/repositories/snapshots/content/org/onap/vnfsdk/refrepo/vnf-sdk-marketplace-deployment/1.0.0/vnf-sdk-marketplace-deployment-1.0.0-20170515.020618-24.zip" && unzip -q -o -B vnf-sdk-marketplace-1.0.0.zip && rm -f vnf-sdk-marketplace-1.0.0.zip EXPOSE 8702 EXPOSE 8703 -# RUN echo ONAP vnf-sdk-marketplace 1.0.0 "https://nexus.onap.org/service/local/repositories/snapshots/content/org/openo/vnfsdk/refrepo/vnf-sdk-marketplace-deployment/1.0.0/vnf-sdk-marketplace-deployment-1.0.0-20170515.020618-24.zip" > ONAP_VERSION + +WORKDIR /service + +RUN mkdir -p /etc/nginx/ssl +COPY nginx.conf /etc/nginx/nginx.conf +COPY certgen.sh . +CMD chmod +x ./certgen.sh +RUN ./certgen.sh + -# 90-entrypoint.txt -RUN cd /service -RUN yum clean all +RUN apt-get update && apt-get install nano -y +RUN apt-get install curl -y + + +#RUN apt-get install vim -y + COPY instance-config.sh . COPY instance-init.sh . @@ -67,10 +103,20 @@ COPY instance-run.sh . COPY instance-workaround.sh . COPY docker-entrypoint.sh . -# Set permissions -RUN find . -type d -exec chmod o-w {} \; -RUN find . -name "*.sh" -exec chmod +x {} \; + + +# Set up microservice +ADD ./STAGE /service +RUN apt-get install -y g++ make && curl -sL https://rpm.nodesource.com/setup_6.x +RUN apt-get install -y nodejs +RUN apt-get install -y npm +RUN apt-get -qq update && apt-get -qq -y install bzip2 +RUN cd /service/webapps/onapui/vnfmarket && npm install phantomjs-prebuilt@2.1.14 --ignore-scripts && npm install +CMD chmod +x ./bin/*.sh && service nginx start + ENTRYPOINT /service/docker-entrypoint.sh +RUN chmod a+x /service/docker-entrypoint.sh +ENTRYPOINT ["/service/docker-entrypoint.sh"] COPY LICENSE ./ONAP_LICENSE diff --git a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/certgen.sh b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/certgen.sh index 796d5777..489e4ee2 100755 --- a/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/certgen.sh +++ b/vnfmarket-be/deployment/docker/docker-refrepo/src/main/docker/certgen.sh @@ -2,5 +2,5 @@ openssl req -nodes -newkey rsa:2048 -keyout example.key -out example.csr -subj "/C=IN/ST=Bangalore/L=Bangalore/O=Global Security/OU=ONAP/CN=example.com" openssl x509 -req -in example.csr -signkey example.key -out cert.crt cp -p cert.crt /etc/nginx/ssl/ -systemctl enable nginx - +cp -p example.key /etc/nginx/ssl/cert.key +#service nginx start & -- cgit 1.2.3-korg