Skip to content

Commit

Permalink
[CE-270] Update Dockerfiles and docs
Browse files Browse the repository at this point in the history
* 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 <yangbaohua@gmail.com>
  • Loading branch information
yeasy committed Feb 11, 2018
1 parent 2891c4f commit 697f38d
Show file tree
Hide file tree
Showing 34 changed files with 138 additions and 228 deletions.
56 changes: 35 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' \
Expand All @@ -126,14 +127,27 @@ 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

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
Expand Down Expand Up @@ -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
24 changes: 12 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions dockerhub/baseimage/Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions dockerhub/engine/Dockerfile

This file was deleted.

22 changes: 22 additions & 0 deletions dockerhub/latest/baseimage/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/Dockerfile-restserver → dockerhub/latest/engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

Original file line number Diff line number Diff line change
@@ -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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hyperledger/cello-baseimage:x86_64-0.8.0-alpha
FROM hyperledger/cello-baseimage:x86_64-latest

COPY nginx/ /tmp/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions dockerhub/latest/operator-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions dockerhub/latest/watchdog/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
File renamed without changes.
24 changes: 0 additions & 24 deletions dockerhub/operator-dashboard/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions dockerhub/operator-dashboard/requirements.txt

This file was deleted.

22 changes: 0 additions & 22 deletions dockerhub/watchdog/Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions dockerhub/watchdog/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions docs/reactjs.md
Original file line number Diff line number Diff line change
@@ -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?
--------------------------------------
Expand Down Expand Up @@ -32,4 +32,4 @@ In the production environment
$ make build-js
```

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
Loading

0 comments on commit 697f38d

Please sign in to comment.