From: garciadeblas Date: Wed, 7 Feb 2018 02:22:37 +0000 (+0100) Subject: Dockerfile-local modified to build the image from local dir; old Dockerfile-local... X-Git-Tag: v3.0.3~2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F5844%2F1;p=osm%2FRO.git Dockerfile-local modified to build the image from local dir; old Dockerfile-local moved to Dockerfile-fromdeb Change-Id: I261873e80b77cfb811d1142f191e269212fe6d93 Signed-off-by: garciadeblas --- 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/docker-compose-3c.yml b/docker/docker-compose-3c.yml new file mode 100644 index 00000000..cd9a12fc --- /dev/null +++ b/docker/docker-compose-3c.yml @@ -0,0 +1,46 @@ +version: '3' +services: + osm-ro-db: + image: mysql + container_name: osm-ro-db + restart: always + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=true + - MYSQL_DATABASE=mano_db + - MYSQL_USER=mano + - MYSQL_PASSWORD=manopw + osm-ro-ovim-db: + image: mysql + container_name: osm-ro-ovim-db + restart: always + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=true + - MYSQL_DATABASE=mano_vim_db + - MYSQL_USER=mano + - MYSQL_PASSWORD=manopw + osm-ro: + build: + context: ../ + dockerfile: docker/Dockerfile-local + image: osm/ro + container_name: osm-ro + restart: always + environment: + - RO_DB_USER=mano + - RO_DB_PASSWORD=manopw + - RO_DB_NAME=mano_db + - RO_DB_HOST=osm-ro-db + - RO_DB_OVIM_USER=mano + - RO_DB_OVIM_PASSWORD=manopw + - RO_DB_OVIM_NAME=mano_vim_db + - RO_DB_OVIM_HOST=osm-ro-ovim-db + ports: + - "9090:9090" + volumes: + - /var/log/osm/openmano/logs:/var/log/osm/openmano/logs + depends_on: + - osm-ro-db + - osm-ro-ovim-db + links: + - osm-ro-db + - osm-ro-ovim-db \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 00000000..d6579ab2 --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,27 @@ +version: '2' +services: + osm-ro-db: + image: mysql + container_name: osm-ro-db + restart: always + environment: + - MYSQL_ROOT_PASSWORD=osm4u + osm-ro: + build: + context: ../ + dockerfile: docker/Dockerfile-local + image: osm/ro + container_name: osm-ro + restart: always + environment: + - RO_DB_ROOT_PASSWORD=osm4u + - DB_HOST=osm-ro-db + ports: + - "9090:9090" + volumes: + - /var/log/osm/openmano/logs:/var/log/osm + depends_on: + - osm-ro-db + links: + - osm-ro-db + diff --git a/docker/openmano-compose-3c.yml b/docker/openmano-compose-3c.yml deleted file mode 100644 index cd9a12fc..00000000 --- a/docker/openmano-compose-3c.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '3' -services: - osm-ro-db: - image: mysql - container_name: osm-ro-db - restart: always - environment: - - MYSQL_RANDOM_ROOT_PASSWORD=true - - MYSQL_DATABASE=mano_db - - MYSQL_USER=mano - - MYSQL_PASSWORD=manopw - osm-ro-ovim-db: - image: mysql - container_name: osm-ro-ovim-db - restart: always - environment: - - MYSQL_RANDOM_ROOT_PASSWORD=true - - MYSQL_DATABASE=mano_vim_db - - MYSQL_USER=mano - - MYSQL_PASSWORD=manopw - osm-ro: - build: - context: ../ - dockerfile: docker/Dockerfile-local - image: osm/ro - container_name: osm-ro - restart: always - environment: - - RO_DB_USER=mano - - RO_DB_PASSWORD=manopw - - RO_DB_NAME=mano_db - - RO_DB_HOST=osm-ro-db - - RO_DB_OVIM_USER=mano - - RO_DB_OVIM_PASSWORD=manopw - - RO_DB_OVIM_NAME=mano_vim_db - - RO_DB_OVIM_HOST=osm-ro-ovim-db - ports: - - "9090:9090" - volumes: - - /var/log/osm/openmano/logs:/var/log/osm/openmano/logs - depends_on: - - osm-ro-db - - osm-ro-ovim-db - links: - - osm-ro-db - - osm-ro-ovim-db \ No newline at end of file diff --git a/docker/openmano-compose.yml b/docker/openmano-compose.yml deleted file mode 100644 index d83b72d0..00000000 --- a/docker/openmano-compose.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: '2' -services: - osm-ro-db: - image: mysql - container_name: osm-ro-db - restart: always - environment: - - MYSQL_ROOT_PASSWORD=osm4u - osm-ro: - build: - context: ../ - dockerfile: docker/Dockerfile-local - image: osm/openmano - container_name: osm-ro - restart: always - environment: - - RO_DB_ROOT_PASSWORD=osm4u - - DB_HOST=osm-ro-db - ports: - - "9090:9090" - volumes: - - /var/log/osm/openmano/logs:/opt/openmano/logs - depends_on: - - osm-ro-db - links: - - osm-ro-db \ No newline at end of file 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