From 697f38df3ba0036d52d5f10cf0c03d11bcf2500b Mon Sep 17 00:00:00 2001 From: Baohua Yang Date: Sun, 11 Feb 2018 13:41:18 +0800 Subject: [PATCH] [CE-270] Update Dockerfiles and docs * Update the dockerfiles by creating a new latest subdir; * Add Cello code into base image, hence other services won't repeat the clone process; * Add documentation for the images. Change-Id: Ib5f8a0870d875e5d44d53b952b5ba3e375b021e3 Signed-off-by: Baohua Yang --- Makefile | 56 ++++++++++++------- docker-compose.yml | 24 ++++---- {config => docker}/baseimage/Dockerfile.in | 2 +- {baseimage => docker/baseimage}/install.sh | 0 {config => docker}/mongo/Dockerfile.in | 0 {config => docker}/nginx/Dockerfile.in | 0 dockerhub/baseimage/Dockerfile | 5 -- dockerhub/engine/Dockerfile | 23 -------- dockerhub/latest/baseimage/Dockerfile | 22 ++++++++ dockerhub/{ => latest}/baseimage/install.sh | 2 +- .../latest/engine/Dockerfile | 12 +--- dockerhub/{ => latest}/mongo/Dockerfile | 2 +- .../{ => latest}/mongo/docker-entrypoint.sh | 0 dockerhub/{ => latest}/nginx/Dockerfile | 2 +- .../nginx/nginx/docker-entrypoint.sh | 0 dockerhub/{ => latest}/nginx/nginx/nginx.conf | 0 .../nginx/nginx/nginx.default.conf | 0 .../latest/operator-dashboard/Dockerfile | 12 ++++ .../{ => latest}/user-dashboard/Dockerfile | 0 .../{ => latest}/user-dashboard/package.json | 0 dockerhub/latest/watchdog/Dockerfile | 8 +++ .../watchdog}/requirements.txt | 0 dockerhub/operator-dashboard/Dockerfile | 24 -------- dockerhub/operator-dashboard/requirements.txt | 20 ------- dockerhub/watchdog/Dockerfile | 22 -------- dockerhub/watchdog/requirements.txt | 20 ------- docs/reactjs.md | 4 +- docs/setup_master.md | 38 +++++++++---- scripts/check_license.sh | 4 +- scripts/master_node/download_images.sh | 11 ++-- scripts/master_node/setup.sh | 2 +- src/Dockerfile-dashboard | 21 ------- src/Dockerfile-watchdog | 17 ------ test/docker-compose.yml | 13 ++--- 34 files changed, 138 insertions(+), 228 deletions(-) rename {config => docker}/baseimage/Dockerfile.in (71%) rename {baseimage => docker/baseimage}/install.sh (100%) rename {config => docker}/mongo/Dockerfile.in (100%) rename {config => docker}/nginx/Dockerfile.in (100%) delete mode 100644 dockerhub/baseimage/Dockerfile delete mode 100644 dockerhub/engine/Dockerfile create mode 100644 dockerhub/latest/baseimage/Dockerfile rename dockerhub/{ => latest}/baseimage/install.sh (99%) rename src/Dockerfile-restserver => dockerhub/latest/engine/Dockerfile (55%) rename dockerhub/{ => latest}/mongo/Dockerfile (82%) rename dockerhub/{ => latest}/mongo/docker-entrypoint.sh (100%) rename dockerhub/{ => latest}/nginx/Dockerfile (81%) rename dockerhub/{ => latest}/nginx/nginx/docker-entrypoint.sh (100%) rename dockerhub/{ => latest}/nginx/nginx/nginx.conf (100%) rename dockerhub/{ => latest}/nginx/nginx/nginx.default.conf (100%) create mode 100644 dockerhub/latest/operator-dashboard/Dockerfile rename dockerhub/{ => latest}/user-dashboard/Dockerfile (100%) rename dockerhub/{ => latest}/user-dashboard/package.json (100%) create mode 100644 dockerhub/latest/watchdog/Dockerfile rename dockerhub/{engine => latest/watchdog}/requirements.txt (100%) delete mode 100644 dockerhub/operator-dashboard/Dockerfile delete mode 100644 dockerhub/operator-dashboard/requirements.txt delete mode 100644 dockerhub/watchdog/Dockerfile delete mode 100644 dockerhub/watchdog/requirements.txt delete mode 100644 src/Dockerfile-dashboard delete mode 100644 src/Dockerfile-watchdog diff --git a/Makefile b/Makefile index 679a5ae8..6a79f559 100644 --- a/Makefile +++ b/Makefile @@ -7,11 +7,12 @@ # This makefile defines the following targets # # - all (default): Builds all targets and runs all tests/checks -# - check: Setup as master node, and runs all tests/checks, will be triggered by CI +# - check: Setup as master node, and runs all tests/checks, will be triggered by CI # - clean: Cleans the build area # - doc: Start a local web service to explore the documentation # - docker[-clean]: Build/clean docker images locally -# - license: checks sourrce files for Apache license header +# - dockerhub: Build using dockerhub materials, to verify them +# - license: Checks sourrce files for Apache license header # - help: Output the help instructions for each command # - log: Check the recent log output of all services # - restart: Stop the cello service and then start @@ -105,7 +106,7 @@ build/docker/%/$(DUMMY): ##@Build an image locally $(eval IMG_NAME = $(BASENAME)-$(TARGET)) @mkdir -p $(@D) @echo "Building docker $(TARGET)" - @cat config/$(TARGET)/Dockerfile.in \ + @cat docker/$(TARGET)/Dockerfile.in \ | sed -e 's|_DOCKER_BASE_|$(DOCKER_BASE)|g' \ | sed -e 's|_NS_|$(DOCKER_NS)|g' \ | sed -e 's|_TAG_|$(IMG_TAG)|g' \ @@ -126,7 +127,19 @@ docker: $(patsubst %,build/docker/%/$(DUMMY),$(DOCKER_IMAGES)) ##@Generate docke docker-clean: image-clean ##@Clean all existing images -.PHONY: license +DOCKERHUB_IMAGES = baseimage engine mongo nginx operator-dashboard user-dashboard watchdog + +dockerhub: $(patsubst %,dockerhub-%,$(DOCKERHUB_IMAGES)) ##@Building latest images with dockerhub materials, to valid them + +dockerhub-%: ##@Building latest images with dockerhub materials, to valid them + dir=$*; \ + IMG=hyperledger/cello-$$dir; \ + echo "Building $$IMG"; \ + docker build \ + -t $$IMG \ + -t $$IMG:x86_64-latest \ + dockerhub/latest/$$dir + license: bash scripts/check_license.sh @@ -134,6 +147,7 @@ install: $(patsubst %,build/docker/%/.push,$(DOCKER_IMAGES)) check: setup-master ##@Code Check code format @$(MAKE) license + find ./docs -type f -name "*.md" -exec egrep -l " +$$" {} \; tox @$(MAKE) test-case make start && sleep 60 && make stop @@ -235,20 +249,20 @@ HELP_FUN = \ print "\n"; } .PHONY: \ - all \ # default to run check - check \ # ci checking - clean \ # clean up the env, remove temp files - changelog \ # update the changelog based on the VERSION tags - doc \ # start a doc server locally - image-clean \ # clean up all cello related images - log \ # show logs of specify service - logs \ # show logs of all services - setup-master \ # setup the master node - setup-worker \ # setup the worker node - redeploy \ # redeploy service(s) - start \ # start all services - restart \ # restart all services - stop \ # stop all services - docker \ # create docker image - license \ # check for Apache license header - + all \ + check \ + clean \ + changelog \ + doc \ + docker \ + dockerhub \ + docker-clean \ + license \ + log \ + logs \ + restart \ + setup-master \ + setup-worker \ + redeploy \ + start \ + stop diff --git a/docker-compose.yml b/docker-compose.yml index cdfbb3a0..53f56c85 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,9 +42,9 @@ services: # cello dashboard service for network operator operator-dashboard: - build: # Remove soon - context: src - dockerfile: Dockerfile-dashboard + #build: # Remove soon + # context: src + # dockerfile: Dockerfile-dashboard image: hyperledger/cello-operator-dashboard container_name: cello-operator-dashboard hostname: cello-operator-dashboard @@ -64,8 +64,8 @@ services: #TODO: need to follow other images to put at dockerhub user-dashboard: - build: # Remove soon - context: user-dashboard + #build: # Remove soon + # context: user-dashboard image: hyperledger/cello-user-dashboard container_name: cello-user-dashboard hostname: cello-user-dashboard @@ -96,9 +96,9 @@ services: # cello engine service engine: - build: - context: src - dockerfile: Dockerfile-restserver # Remove soon + #build: + # context: src + # dockerfile: Dockerfile-restserver # Remove soon image: hyperledger/cello-engine container_name: cello-engine hostname: cello-engine @@ -115,9 +115,9 @@ services: # cello watchdog service watchdog: - build: # Remove soon - context: src - dockerfile: Dockerfile-watchdog + #build: # Remove soon + # context: src + # dockerfile: Dockerfile-watchdog image: hyperledger/cello-watchdog container_name: cello-watchdog hostname: cello-watchdog @@ -153,7 +153,7 @@ services: volumes: - /opt/cello/mongo:/data/db - # TODO: we may keep only one mongo instance, that should be enough + # TODO: we may use one mongo instance, that should be enough dashboard_mongo: image: hyperledger/cello-mongo restart: unless-stopped diff --git a/config/baseimage/Dockerfile.in b/docker/baseimage/Dockerfile.in similarity index 71% rename from config/baseimage/Dockerfile.in rename to docker/baseimage/Dockerfile.in index f8a79697..7f03092e 100644 --- a/config/baseimage/Dockerfile.in +++ b/docker/baseimage/Dockerfile.in @@ -1,5 +1,5 @@ FROM _DOCKER_BASE_ -COPY baseimage /tmp/baseimage +COPY docker/baseimage /tmp/baseimage RUN cd /tmp/baseimage && \ bash install.sh && \ rm -rf /tmp/baseimage diff --git a/baseimage/install.sh b/docker/baseimage/install.sh similarity index 100% rename from baseimage/install.sh rename to docker/baseimage/install.sh diff --git a/config/mongo/Dockerfile.in b/docker/mongo/Dockerfile.in similarity index 100% rename from config/mongo/Dockerfile.in rename to docker/mongo/Dockerfile.in diff --git a/config/nginx/Dockerfile.in b/docker/nginx/Dockerfile.in similarity index 100% rename from config/nginx/Dockerfile.in rename to docker/nginx/Dockerfile.in diff --git a/dockerhub/baseimage/Dockerfile b/dockerhub/baseimage/Dockerfile deleted file mode 100644 index 193e60ea..00000000 --- a/dockerhub/baseimage/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:xenial -COPY install.sh /tmp/ -RUN cd /tmp/ && \ - bash install.sh && \ -rm -f /tmp/install.sh diff --git a/dockerhub/engine/Dockerfile b/dockerhub/engine/Dockerfile deleted file mode 100644 index 82a9051f..00000000 --- a/dockerhub/engine/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM hyperledger/cello-baseimage:x86_64-latest -MAINTAINER Yinxia Zhang <"zhangyinxia@inspur.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt - -RUN apt-get install -y wget git-core -RUN cd /tmp && git clone https://github.com/hyperledger/cello.git -RUN cp -r /tmp/cello/src /app - -WORKDIR /app/src -# use this in development -CMD ["python", "restserver.py"] - -# use this in product -#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:80", "restserver:app"] - diff --git a/dockerhub/latest/baseimage/Dockerfile b/dockerhub/latest/baseimage/Dockerfile new file mode 100644 index 00000000..bf808fda --- /dev/null +++ b/dockerhub/latest/baseimage/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:xenial + +LABEL maintainer="github.com/hyperledger/cello" + +WORKDIR /app + +COPY install.sh /tmp/ + +# Install necessary software +RUN cd /tmp/ && \ + bash install.sh && \ + rm -f /tmp/install.sh + +# Clone code and put cello/src/* under /app +RUN cd /tmp && \ + git clone https://github.com/hyperledger/cello.git && \ + cd /tmp/cello && \ + git checkout master && \ + cp -r /tmp/cello/src/* /app && \ + cd /app/ && \ + pip install -r requirements.txt && \ + rm -rf /tmp/cello diff --git a/dockerhub/baseimage/install.sh b/dockerhub/latest/baseimage/install.sh similarity index 99% rename from dockerhub/baseimage/install.sh rename to dockerhub/latest/baseimage/install.sh index 5eba2110..467c78e1 100644 --- a/dockerhub/baseimage/install.sh +++ b/dockerhub/latest/baseimage/install.sh @@ -81,7 +81,7 @@ rm -f /tmp/node*.tar.gz if [[ $ARCH = 'ppc64le' ]];then apt-get install build-essential libssl-dev libffi-dev python3-dev libxslt-dev python3 -y else -apt-get install python3 -y +apt-get install python3 git -y fi update-alternatives --install /usr/bin/python python /usr/bin/python3 10 diff --git a/src/Dockerfile-restserver b/dockerhub/latest/engine/Dockerfile similarity index 55% rename from src/Dockerfile-restserver rename to dockerhub/latest/engine/Dockerfile index cb52cc0c..59f6c1b5 100644 --- a/src/Dockerfile-restserver +++ b/dockerhub/latest/engine/Dockerfile @@ -1,20 +1,12 @@ - # Copyright IBM Corp, All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 # -FROM hyperledger/cello-baseimage -MAINTAINER Baohua Yang <"baohyang@cn.ibm.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt - -COPY . /app +FROM hyperledger/cello-baseimage:x86_64-latest # use this in development CMD ["python", "restserver.py"] # use this in product #CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:80", "restserver:app"] + diff --git a/dockerhub/mongo/Dockerfile b/dockerhub/latest/mongo/Dockerfile similarity index 82% rename from dockerhub/mongo/Dockerfile rename to dockerhub/latest/mongo/Dockerfile index 0c2dca5c..1cdf7ee3 100644 --- a/dockerhub/mongo/Dockerfile +++ b/dockerhub/latest/mongo/Dockerfile @@ -1,4 +1,4 @@ -FROM hyperledger/cello-baseimage:x86_64-0.8.0-alpha +FROM hyperledger/cello-baseimage:x86_64-latest COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh diff --git a/dockerhub/mongo/docker-entrypoint.sh b/dockerhub/latest/mongo/docker-entrypoint.sh similarity index 100% rename from dockerhub/mongo/docker-entrypoint.sh rename to dockerhub/latest/mongo/docker-entrypoint.sh diff --git a/dockerhub/nginx/Dockerfile b/dockerhub/latest/nginx/Dockerfile similarity index 81% rename from dockerhub/nginx/Dockerfile rename to dockerhub/latest/nginx/Dockerfile index 6e40105d..747d34eb 100644 --- a/dockerhub/nginx/Dockerfile +++ b/dockerhub/latest/nginx/Dockerfile @@ -1,4 +1,4 @@ -FROM hyperledger/cello-baseimage:x86_64-0.8.0-alpha +FROM hyperledger/cello-baseimage:x86_64-latest COPY nginx/ /tmp/ diff --git a/dockerhub/nginx/nginx/docker-entrypoint.sh b/dockerhub/latest/nginx/nginx/docker-entrypoint.sh similarity index 100% rename from dockerhub/nginx/nginx/docker-entrypoint.sh rename to dockerhub/latest/nginx/nginx/docker-entrypoint.sh diff --git a/dockerhub/nginx/nginx/nginx.conf b/dockerhub/latest/nginx/nginx/nginx.conf similarity index 100% rename from dockerhub/nginx/nginx/nginx.conf rename to dockerhub/latest/nginx/nginx/nginx.conf diff --git a/dockerhub/nginx/nginx/nginx.default.conf b/dockerhub/latest/nginx/nginx/nginx.default.conf similarity index 100% rename from dockerhub/nginx/nginx/nginx.default.conf rename to dockerhub/latest/nginx/nginx/nginx.default.conf diff --git a/dockerhub/latest/operator-dashboard/Dockerfile b/dockerhub/latest/operator-dashboard/Dockerfile new file mode 100644 index 00000000..70a77748 --- /dev/null +++ b/dockerhub/latest/operator-dashboard/Dockerfile @@ -0,0 +1,12 @@ +# Copyright IBM Corp, All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +FROM hyperledger/cello-baseimage:x86_64-latest + +# use this in development +CMD ["python", "dashboard.py"] + +# use this in product +#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:8080", "dashboard:app"] + diff --git a/dockerhub/user-dashboard/Dockerfile b/dockerhub/latest/user-dashboard/Dockerfile similarity index 100% rename from dockerhub/user-dashboard/Dockerfile rename to dockerhub/latest/user-dashboard/Dockerfile diff --git a/dockerhub/user-dashboard/package.json b/dockerhub/latest/user-dashboard/package.json similarity index 100% rename from dockerhub/user-dashboard/package.json rename to dockerhub/latest/user-dashboard/package.json diff --git a/dockerhub/latest/watchdog/Dockerfile b/dockerhub/latest/watchdog/Dockerfile new file mode 100644 index 00000000..8d67e5b9 --- /dev/null +++ b/dockerhub/latest/watchdog/Dockerfile @@ -0,0 +1,8 @@ +# Copyright IBM Corp, All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +FROM hyperledger/cello-baseimage:x86_64-latest + +# use this in development +CMD ["python", "watchdog.py"] \ No newline at end of file diff --git a/dockerhub/engine/requirements.txt b/dockerhub/latest/watchdog/requirements.txt similarity index 100% rename from dockerhub/engine/requirements.txt rename to dockerhub/latest/watchdog/requirements.txt diff --git a/dockerhub/operator-dashboard/Dockerfile b/dockerhub/operator-dashboard/Dockerfile deleted file mode 100644 index 387ea21b..00000000 --- a/dockerhub/operator-dashboard/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM hyperledger/cello-baseimage:x86_64-latest -MAINTAINER Yinxia Zhang <"zhangyinxia@inspur.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt - -RUN apt-get install -y wget git-core -RUN cd /tmp && git clone https://github.com/hyperledger/cello.git -RUN cp -r /tmp/cello/src /app - -WORKDIR /app/src - -# use this in development -CMD ["python", "dashboard.py"] - -# use this in product -#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:8080", "dashboard:app"] - diff --git a/dockerhub/operator-dashboard/requirements.txt b/dockerhub/operator-dashboard/requirements.txt deleted file mode 100644 index cdc8b45f..00000000 --- a/dockerhub/operator-dashboard/requirements.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -docker-compose>=1.16.0,<=1.18.0 -Flask>=0.10.0,<=1.12.0 -greenlet>=0.4.5,<=0.4.12 -gunicorn>=19.0.0,<=19.6.0 -pymongo>=3.2.0,<=3.4.0 -requests>=2.0.0,<=2.13.0 -mongoengine>=0.10.0,<=0.13.0 -flask-login>=0.4.0,<=0.4.0 -bcrypt>=3.0.0,<=3.1.0 -flask-restful>=0.2.1,<=0.3.6 -Flask-Testing>=0.5.0,<=0.6.2 -Faker>=0.7.17,<=0.7.18 -pyvmomi>=5.5.0,<=6.5.0 -enum34>=1.1.0,<=1.1.6 -marshmallow>=2.13.6,<=2.14.0 diff --git a/dockerhub/watchdog/Dockerfile b/dockerhub/watchdog/Dockerfile deleted file mode 100644 index 8d9808db..00000000 --- a/dockerhub/watchdog/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM hyperledger/cello-baseimage:x86_64-latest -MAINTAINER Yinxia Zhang <"zhangyinxia@inspur.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt - -RUN apt-get install -y wget git-core -RUN cd /tmp && git clone https://github.com/hyperledger/cello.git -RUN cp -r /tmp/cello/src /app - -WORKDIR /app/src - -# use this in development -CMD ["python", "watchdog.py"] - - diff --git a/dockerhub/watchdog/requirements.txt b/dockerhub/watchdog/requirements.txt deleted file mode 100644 index cdc8b45f..00000000 --- a/dockerhub/watchdog/requirements.txt +++ /dev/null @@ -1,20 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -docker-compose>=1.16.0,<=1.18.0 -Flask>=0.10.0,<=1.12.0 -greenlet>=0.4.5,<=0.4.12 -gunicorn>=19.0.0,<=19.6.0 -pymongo>=3.2.0,<=3.4.0 -requests>=2.0.0,<=2.13.0 -mongoengine>=0.10.0,<=0.13.0 -flask-login>=0.4.0,<=0.4.0 -bcrypt>=3.0.0,<=3.1.0 -flask-restful>=0.2.1,<=0.3.6 -Flask-Testing>=0.5.0,<=0.6.2 -Faker>=0.7.17,<=0.7.18 -pyvmomi>=5.5.0,<=6.5.0 -enum34>=1.1.0,<=1.1.6 -marshmallow>=2.13.6,<=2.14.0 diff --git a/docs/reactjs.md b/docs/reactjs.md index 253acacb..d0c9f491 100644 --- a/docs/reactjs.md +++ b/docs/reactjs.md @@ -1,4 +1,4 @@ -** **This is another Front-end implementation for cello dashboard, if you want to use this version, must change the theme into reactjs. +** **This is another Front-end implementation for cello dashboard, if you want to use this version, must change the theme into reactjs. How to start service with react theme? -------------------------------------- @@ -32,4 +32,4 @@ In the production environment $ make build-js ``` -Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. \ No newline at end of file +Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/docs/setup_master.md b/docs/setup_master.md index cb4c34d6..314be392 100644 --- a/docs/setup_master.md +++ b/docs/setup_master.md @@ -88,20 +88,36 @@ In MacOS, Docker cannot mount local path from host by default. Hence for mongo c * Make sure the `/opt/cello` path exists locally, and it is writable for the current user account. Simply just run `make setup-master`. * Add the path to `File Sharing` list in the preference of [Docker for MacOS](https://docs.docker.com/docker-for-mac/install/), to make it mountable by container. -## Cello Baseimage -![BaseImage](imgs/cello_baseimage.png) +## More Commands using make -The purpose of this baseimage is to act as a bridge between a raw ubuntu/xenial configuration and the customizations -required for supporting a Hyperledger Cello environment. The build process is generally expensive so it is fairly -inefficient to JIT assemble these components on demand. Hence bundled into baseimage and subsequently cached on -the public repositories, so they can be simply consumed without requiring a local build cycle. +To know more what the following make commands does please refer [make_support](./make_support.md) page. -### Usage -* "make docker" will build the docker images and commit it to your local environment; e.g. "hyperledger/cello-baseimage". -The docker image is also tagged with architecture and release details. +## Cello Docker Images -### More Commands using make +Cello project also provide Docker images for quick adoptions, users can pull these images from dockerhub or build locally. -To know more what the following make commands does please refer [make_support](./make_support.md) page. +![Docker Images](imgs/cello_baseimage.png) + +### Pull from Dockerhub +The build process is generally expensive so you may wanna just pull those images from Dockerhub. + +Run `cd scripts/master_node && bash download_images.sh` will pull the following images: + +* [hyperledger/cello-baseimage](https://hub.docker.com/r/hyperledger/cello-baseimage/): Base images for the service images. +* [hyperledger/cello-engine](https://hub.docker.com/r/hyperledger/cello-engine/): Docker images for the engine service. +* [hyperledger/cello-mongo](https://hub.docker.com/r/hyperledger/cello-mongo/): Docker images for the Mongo DB service. +* [hyperledger/cello-nginx](https://hub.docker.com/r/hyperledger/cello-nginx/): Docker images for the Nginx service. +* [hyperledger/cello-operator-dashboard](https://hub.docker.com/r/hyperledger/cello-operator-dashboard/): Docker images for the Operator Dashboard service. +* [hyperledger/cello-user-dashboard](https://hub.docker.com/r/hyperledger/cello-user-dashboard/): Docker images for the User Dashboard service. + +By default, the `laetst` version of images will be pulled, and you may optionally specify the version of images to pull down: + +``` +$ cd scripts/master_node +$ VERSION=0.8.0-beta bash download_images.sh +``` + +### Local Building +Run `make docker` will build the docker images locally and commit with architecture and version tag; e.g. "hyperledger/cello-baseimage:x86_64-0.8.0-snapshot-7b7fab6". Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/scripts/check_license.sh b/scripts/check_license.sh index da50ee9c..5f71e191 100644 --- a/scripts/check_license.sh +++ b/scripts/check_license.sh @@ -8,7 +8,7 @@ CHECK=$(git diff --name-only HEAD * | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \ | grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \ | grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \ - | grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v agent/ \ + | grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v docker/ | grep -v dockerhub/ | grep -v agent/ \ | grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u) if [[ -z "$CHECK" ]]; then @@ -16,7 +16,7 @@ if [[ -z "$CHECK" ]]; then --pretty=format:"%h") | grep -v check_license.sh | grep -v .json$ | grep -v .jpg$ | grep -v .JPG$ | grep -v .png$ | grep -v .ico$ \ | grep -v .graffle$ | grep -v .svg$ | grep -v .pug$ | grep -v .rst$ | grep -v .git \ | grep -v .pem$ | grep -v .crt$ | grep -v .key$ | grep -v lib/ | grep -v fonts/ | grep -v .min.css$ \ - | grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v agent/ \ + | grep -v .block$ | grep -v .less$ | grep -v crypto-config/ | grep -v .min.js$ | grep -v .tx$ | grep -v .go$ | grep -v docker/ | grep -v dockerhub/ | grep -v agent/ \ | grep -v .md$ | grep -v ^vendor/ | grep -v ^build/ | grep -v .pb.go$ | grep -v .txt | grep -v .env | sort -u) fi diff --git a/scripts/master_node/download_images.sh b/scripts/master_node/download_images.sh index 38f7a7ce..f9f8c1e1 100644 --- a/scripts/master_node/download_images.sh +++ b/scripts/master_node/download_images.sh @@ -23,22 +23,23 @@ else } fi -echo_b "Downloading the docker images for master node" +ARCH=$(uname -m) +VERSION="${VERSION:-latest}" + +echo_b "Downloading the docker images for Cello services: VERSION=${VERSION} ARCH=${ARCH}" # TODO: will be removed after we have the user dashboard image echo_b "Check node:9.2 image." [ -z "$(docker images -q node:9.2 2> /dev/null)" ] && { echo "pulling node:9.2"; docker pull node:9.2; } # docker image -ARCH=$(uname -m) -VERSION=latest for IMG in baseimage engine mongo nginx operator-dashboard user-dashboard watchdog ; do HLC_IMG=hyperledger/cello-${IMG} - if [ -z "$(docker images -q ${HLC_IMG} 2> /dev/null)" ]; then # not exist + if [ -z "$(docker images -q ${HLC_IMG}:${ARCH}-${VERSION} 2> /dev/null)" ]; then # not exist echo_b "Pulling ${HLC_IMG}:${ARCH}-${VERSION} from dockerhub" docker pull ${HLC_IMG}:${ARCH}-${VERSION} - docker tag ${HLC_IMG}:${ARCH}-${VERSION} ${HLC_IMG} + docker tag ${HLC_IMG}:${ARCH}-${VERSION} ${HLC_IMG} # match the docker-compose file else echo_g "${HLC_IMG} already exist locally" fi diff --git a/scripts/master_node/setup.sh b/scripts/master_node/setup.sh index 519b613e..394feed0 100755 --- a/scripts/master_node/setup.sh +++ b/scripts/master_node/setup.sh @@ -112,7 +112,7 @@ if [ `sudo docker ps -qa|wc -l` -gt 0 ]; then docker ps -a fi -echo_b "Download required Docker images..." +echo_b "Download required Docker images for Cello Services..." bash ./download_images.sh echo_b "Checking local mounted database path ${DB_DIR}..." diff --git a/src/Dockerfile-dashboard b/src/Dockerfile-dashboard deleted file mode 100644 index f986b4d9..00000000 --- a/src/Dockerfile-dashboard +++ /dev/null @@ -1,21 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM hyperledger/cello-baseimage -MAINTAINER Baohua Yang <"baohyang@cn.ibm.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt -#RUN pip install --no-cache-dir -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com -r requirements.txt - -COPY . /app - -# use this in development -CMD ["python", "dashboard.py"] - -# use this in product -#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:8080", "dashboard:app"] diff --git a/src/Dockerfile-watchdog b/src/Dockerfile-watchdog deleted file mode 100644 index 562085fd..00000000 --- a/src/Dockerfile-watchdog +++ /dev/null @@ -1,17 +0,0 @@ - -# Copyright IBM Corp, All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -FROM hyperledger/cello-baseimage -MAINTAINER Baohua Yang <"baohyang@cn.ibm.com"> -ENV TZ Asia/Shanghai - -WORKDIR /app -COPY ./requirements.txt /app -RUN pip install -r requirements.txt - -COPY . /app - -# use this in development -CMD ["python", "watchdog.py"] diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 277e6fea..5054279c 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -12,14 +12,11 @@ version: '2' services: - # cello dashboard service - dashboard: - build: - context: ../src - dockerfile: Dockerfile-dashboard - image: hyperledger/cello-dashboard - container_name: dashboard-test - hostname: cello-dashboard + # cello operator dashboard service + operator-dashboard: + image: hyperledger/cello-operator-dashboard + container_name: operator-dashboard-test + hostname: cello-operator-dashboard environment: - MONGO_URL=mongodb://mongo:27017 - MONGO_DB=dev