From 0cb7df3190343531e2ccd4b5d404780af678936e Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Wed, 7 Feb 2018 03:22:37 +0100 Subject: [PATCH] Dockerfile-local modified to build the image from local dir; old Dockerfile-local moved to Dockerfile-fromdeb Change-Id: I261873e80b77cfb811d1142f191e269212fe6d93 Signed-off-by: garciadeblas --- docker/Dockerfile-fromdeb | 58 +++++++++++ docker/Dockerfile-local | 99 +++++++++++-------- ...o-compose-3c.yml => docker-compose-3c.yml} | 0 ...enmano-compose.yml => docker-compose.yaml} | 7 +- docker/scripts/start.sh | 2 +- 5 files changed, 119 insertions(+), 47 deletions(-) create mode 100644 docker/Dockerfile-fromdeb rename docker/{openmano-compose-3c.yml => docker-compose-3c.yml} (100%) rename docker/{openmano-compose.yml => docker-compose.yaml} (82%) diff --git a/docker/Dockerfile-fromdeb b/docker/Dockerfile-fromdeb new file mode 100644 index 00000000..08e3f231 --- /dev/null +++ b/docker/Dockerfile-fromdeb @@ -0,0 +1,58 @@ +from ubuntu:xenial + +MAINTAINER Gennadiy Dubina ; Alfonso Tierno + +#avoid extra information from packages +RUN echo 'path-exclude /usr/share/doc/*\n\ +path-include /usr/share/doc/*/copyright\n\ +path-exclude /usr/share/man/*\n\ +path-exclude /usr/share/groff/*\n\ +path-exclude /usr/share/info/*\n\ +path-exclude /usr/share/lintian/*\n\ +path-exclude /usr/share/linda/*\n'\ +> /etc/dpkg/dpkg.cfg.d/01_nodoc && \ + echo 'APT::Install-Recommends "false";\n\ +APT::AutoRemove::RecommendsImportant "false";\n\ +APT::AutoRemove::SuggestsImportant "false";\n'\ +> /etc/apt/apt.conf.d/99_norecommends + + +RUN apt update && apt install -y curl mysql-client software-properties-common \ + && add-apt-repository -y "deb http://osm-download.etsi.org/repository/osm/debian/ReleaseTHREE stable SO UI RO IM osmclient openvim" \ + && curl "http://osm-download.etsi.org/repository/osm/debian/ReleaseTHREE/OSM%20ETSI%20Release%20Key.gpg" | apt-key add - \ + && apt update \ + && apt install -y python-osm-ro \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /bin/RO + + +COPY docker/scripts/ /bin/RO + +VOLUME /opt/openmano/logs + +EXPOSE 9090 + +# Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers +# These ENV must be provided +ENV RO_DB_HOST="" +ENV RO_DB_OVIM_HOST="" + # if empty RO_DB_HOST is assumed + +# These ENV should be provided first time for creating database. It will create and init only if empty! +ENV RO_DB_ROOT_PASSWORD="" +ENV RO_DB_OVIM_ROOT_PASSWORD="" + # if empty RO_DB_ROOT_PASSWORD is assumed + +# These ENV can be provided, but default values are ok +ENV RO_DB_USER=mano +ENV RO_DB_OVIM_USER=mano +ENV RO_DB_PASSWORD=manopw +ENV RO_DB_OVIM_PASSWORD=manopw +ENV RO_DB_PORT=3306 +ENV RO_DB_OVIM_PORT=3306 +ENV RO_DB_NAME=mano_db +ENV RO_DB_OVIM_NAME=mano_vim_db + + +CMD /bin/RO/start.sh + diff --git a/docker/Dockerfile-local b/docker/Dockerfile-local index 08e3f231..e031cf3d 100644 --- a/docker/Dockerfile-local +++ b/docker/Dockerfile-local @@ -1,58 +1,71 @@ from ubuntu:xenial -MAINTAINER Gennadiy Dubina ; Alfonso Tierno - -#avoid extra information from packages -RUN echo 'path-exclude /usr/share/doc/*\n\ -path-include /usr/share/doc/*/copyright\n\ -path-exclude /usr/share/man/*\n\ -path-exclude /usr/share/groff/*\n\ -path-exclude /usr/share/info/*\n\ -path-exclude /usr/share/lintian/*\n\ -path-exclude /usr/share/linda/*\n'\ -> /etc/dpkg/dpkg.cfg.d/01_nodoc && \ - echo 'APT::Install-Recommends "false";\n\ -APT::AutoRemove::RecommendsImportant "false";\n\ -APT::AutoRemove::SuggestsImportant "false";\n'\ -> /etc/apt/apt.conf.d/99_norecommends - - -RUN apt update && apt install -y curl mysql-client software-properties-common \ - && add-apt-repository -y "deb http://osm-download.etsi.org/repository/osm/debian/ReleaseTHREE stable SO UI RO IM osmclient openvim" \ - && curl "http://osm-download.etsi.org/repository/osm/debian/ReleaseTHREE/OSM%20ETSI%20Release%20Key.gpg" | apt-key add - \ - && apt update \ - && apt install -y python-osm-ro \ - && rm -rf /var/lib/apt/lists/* \ - && mkdir -p /bin/RO +LABEL authors="Gennadiy Dubina, Alfonso Tierno, Gerardo Garcia" +COPY . /root/RO COPY docker/scripts/ /bin/RO -VOLUME /opt/openmano/logs +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \ + apt-get update && \ + DEBIAN_FRONTEND=noninteractive add-apt-repository -y cloud-archive:ocata && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install git make python python-pip debhelper && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install wget tox && \ + DEBIAN_FRONTEND=noninteractive pip install -U pip && \ + DEBIAN_FRONTEND=noninteractive pip install -U setuptools setuptools-version-command stdeb && \ + DEBIAN_FRONTEND=noninteractive pip install -U pyang pyangbind && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install python-yaml python-netaddr python-boto && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install python-novaclient python-keystoneclient python-glanceclient python-cinderclient python-neutronclient && \ + DEBIAN_FRONTEND=noninteractive pip install -U progressbar pyvmomi pyvcloud==18.2.2 && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install python-argcomplete python-bottle python-cffi python-packaging python-paramiko python-pkgconfig libmysqlclient-dev libssl-dev libffi-dev python-mysqldb && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install python-logutils python-openstackclient python-openstacksdk && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install python-bitarray && \ + DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-client && \ + mkdir -p /root/RO && \ + make -C /root/RO clean all BRANCH=master && \ + dpkg -i /root/RO/IM/deb_dist/python-pyang_*.deb && \ + dpkg -i /root/RO/IM/deb_dist/python-pyangbind_*.deb && \ + dpkg -i /root/RO/IM/deb_dist/python-osm-im*.deb && \ + dpkg -i /root/RO/openvim/.build/python-lib-osm-openvim*.deb && \ + dpkg -i /root/RO/.build/python-osm-ro*.deb && \ + rm -rf /root/.cache && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + rm -rf /root/RO + +VOLUME /var/log/osm EXPOSE 9090 # Two mysql databases are needed (DB and DB_OVIM). Can be hosted on same or separated containers # These ENV must be provided -ENV RO_DB_HOST="" -ENV RO_DB_OVIM_HOST="" - # if empty RO_DB_HOST is assumed - -# These ENV should be provided first time for creating database. It will create and init only if empty! -ENV RO_DB_ROOT_PASSWORD="" -ENV RO_DB_OVIM_ROOT_PASSWORD="" - # if empty RO_DB_ROOT_PASSWORD is assumed - -# These ENV can be provided, but default values are ok -ENV RO_DB_USER=mano -ENV RO_DB_OVIM_USER=mano -ENV RO_DB_PASSWORD=manopw -ENV RO_DB_OVIM_PASSWORD=manopw -ENV RO_DB_PORT=3306 -ENV RO_DB_OVIM_PORT=3306 -ENV RO_DB_NAME=mano_db -ENV RO_DB_OVIM_NAME=mano_vim_db +# RO_DB_HOST: host of the main +# RO_DB_OVIM_HOST: ... if empty RO_DB_HOST is assumed +# RO_DB_ROOT_PASSWORD: this has to be provided first time for creating database. It will create and init only if empty! +# RO_DB_OVIM_ROOT_PASSWORD: ... if empty RO_DB_ROOT_PASSWORD is assumed +# RO_DB_USER: default value 'mano' +# RO_DB_OVIM_USER: default value 'mano' +# RO_DB_PASSWORD: default value 'manopw' +# RO_DB_OVIM_PASSWORD: default value 'manopw' +# RO_DB_PORT: default value '3306' +# RO_DB_OVIM_PORT: default value '3306' +# RO_DB_NAME: default value 'mano_db' +# RO_DB_OVIM_NAME: default value 'mano_vim_db' +ENV RO_DB_HOST="" \ + RO_DB_OVIM_HOST="" \ + RO_DB_ROOT_PASSWORD="" \ + RO_DB_OVIM_ROOT_PASSWORD="" \ + RO_DB_USER=mano \ + RO_DB_OVIM_USER=mano \ + RO_DB_PASSWORD=manopw \ + RO_DB_OVIM_PASSWORD=manopw \ + RO_DB_PORT=3306 \ + RO_DB_OVIM_PORT=3306 \ + RO_DB_NAME=mano_db \ + RO_DB_OVIM_NAME=mano_vim_db CMD /bin/RO/start.sh diff --git a/docker/openmano-compose-3c.yml b/docker/docker-compose-3c.yml similarity index 100% rename from docker/openmano-compose-3c.yml rename to docker/docker-compose-3c.yml diff --git a/docker/openmano-compose.yml b/docker/docker-compose.yaml similarity index 82% rename from docker/openmano-compose.yml rename to docker/docker-compose.yaml index d83b72d0..d6579ab2 100644 --- a/docker/openmano-compose.yml +++ b/docker/docker-compose.yaml @@ -10,7 +10,7 @@ services: build: context: ../ dockerfile: docker/Dockerfile-local - image: osm/openmano + image: osm/ro container_name: osm-ro restart: always environment: @@ -19,8 +19,9 @@ services: ports: - "9090:9090" volumes: - - /var/log/osm/openmano/logs:/opt/openmano/logs + - /var/log/osm/openmano/logs:/var/log/osm depends_on: - osm-ro-db links: - - osm-ro-db \ No newline at end of file + - osm-ro-db + diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh index 486f3a0a..136bf852 100755 --- a/docker/scripts/start.sh +++ b/docker/scripts/start.sh @@ -125,4 +125,4 @@ fi echo "4/4 Try to start" -openmanod -c /etc/osm/openmanod.cfg --log-file=/var/log/osm/openmano.log +/usr/bin/openmanod -c /etc/osm/openmanod.cfg --log-file=/var/log/osm/openmano.log -- 2.25.1