Skip to content

Commit

Permalink
Merge "[CE-272] Update Dockerfiles for beta"
Browse files Browse the repository at this point in the history
  • Loading branch information
hightall authored and Gerrit Code Review committed Feb 12, 2018
2 parents bd6d527 + 2f23940 commit f1ed1ce
Show file tree
Hide file tree
Showing 11 changed files with 244 additions and 88 deletions.
20 changes: 0 additions & 20 deletions dockerhub/latest/watchdog/requirements.txt

This file was deleted.

22 changes: 22 additions & 0 deletions dockerhub/v0.8.0-beta/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 v0.8.0-beta && \
cp -r /tmp/cello/src/* /app && \
cd /app/ && \
pip install -r requirements.txt && \
rm -rf /tmp/cello
97 changes: 97 additions & 0 deletions dockerhub/v0.8.0-beta/baseimage/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -x
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Based thie file on https://github.com/docker-library/mongo/blob/master/3.4/Dockerfile &
# https://docs.mongodb.com/manual/tutorial/install-mongodb-enterprise-on-ubuntu/#install-mongodb-enterprise

# ----------------------------------------------------------------
# Install mongo
# ----------------------------------------------------------------

groupadd -r mongodb && useradd -r -g mongodb mongodb

apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates jq numactl sudo\
&& rm -rf /var/lib/apt/lists/*

# grab gosu for easy step-down from root
export GOSU_VERSION=1.10

set -x \
&& apt-get update && apt-get install -y --no-install-recommends wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true

mkdir /docker-entrypoint-initdb.d

# Add GPG Keys & update apt sources

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb [ arch=amd64,arm64,ppc64el,s390x ] http://repo.mongodb.com/apt/ubuntu xenial/mongodb-enterprise/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-enterprise.list

apt-get update

export MONGO_PACKAGE=mongodb-enterprise
# export MONGO_REPO=repo.mongodb.com
# export MONGO_PACKAGE=${MONGO_PACKAGE} MONGO_REPO=${MONGO_REPO}

export MONGO_MAJOR=3.4
export MONGO_VERSION=3.4.10

apt-get install -y \
${MONGO_PACKAGE}=$MONGO_VERSION \
${MONGO_PACKAGE}-server=$MONGO_VERSION \
${MONGO_PACKAGE}-shell=$MONGO_VERSION \
${MONGO_PACKAGE}-mongos=$MONGO_VERSION \
${MONGO_PACKAGE}-tools=$MONGO_VERSION

mkdir -p /data/db /data/configdb \
&& chown -R mongodb:mongodb /data/db /data/configdb

# ----------------------------------------------------------------
# Install NodeJS
# ----------------------------------------------------------------
NODE_VER=8.9.0

ARCH=`uname -m | sed 's|i686|x86|' | sed 's|x86_64|x64|'`
NODE_PKG=node-v$NODE_VER-linux-$ARCH.tar.gz
SRC_PATH=/tmp/$NODE_PKG

# First remove any prior packages downloaded in case of failure
cd /tmp
rm -f node*.tar.gz
wget --quiet https://nodejs.org/dist/v$NODE_VER/$NODE_PKG
cd /usr/local && sudo tar --strip-components 1 -xzf $SRC_PATH
rm -f /tmp/node*.tar.gz

# ----------------------------------------------------------------
# Install python3 and pip
# ----------------------------------------------------------------
if [[ $ARCH = 'ppc64le' ]];then
apt-get install build-essential libssl-dev libffi-dev python3-dev libxslt-dev python3 -y
else
apt-get install python3 git -y
fi

update-alternatives --install /usr/bin/python python /usr/bin/python3 10
cd /tmp
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
rm get-pip.py

# ----------------------------------------------------------------
# Install nginx
# ----------------------------------------------------------------
groupadd -r nginx && useradd -r -g nginx nginx
apt-get install nginx apache2-utils -y
13 changes: 1 addition & 12 deletions dockerhub/v0.8.0-beta/engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@

# Copyright IBM Corp, All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
FROM hyperledger/cello-baseimage:x86_64-0.8.0-beta
MAINTAINER Baohua Yang <"baohyang@cn.ibm.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"]

20 changes: 0 additions & 20 deletions dockerhub/v0.8.0-beta/engine/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion dockerhub/v0.8.0-beta/nginx/nginx/nginx.default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This file should be put under /etc/nginx/conf.d/
# Or place as /etc/nginx/nginx.conf


user nginx;
worker_processes auto;
daemon off;
Expand Down
12 changes: 12 additions & 0 deletions dockerhub/v0.8.0-beta/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-0.8.0-beta

# use this in development
CMD ["python", "dashboard.py"]

# use this in product
#CMD ["gunicorn", "-w", "128", "-b", "0.0.0.0:8080", "dashboard:app"]

52 changes: 52 additions & 0 deletions dockerhub/v0.8.0-beta/user-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright IBM Corp, All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
FROM node:9.2 as build_login
MAINTAINER haitao yue "hightall@me.com"
RUN cd /tmp && git clone https://github.com/hyperledger/cello.git
RUN cd /tmp/cello && git checkout v0.8.0-beta
RUN cp -r /tmp/cello/user-dashboard/js /app
RUN mkdir -p /usr/app
RUN cp -r /tmp/cello/user-dashboard /usr/app/src
RUN cd /app && npm install --loglevel http && npm run build

FROM node:9.2 as build_home
MAINTAINER haitao yue "hightall@me.com"
RUN cd /tmp && git clone https://github.com/hyperledger/cello.git
RUN cd /tmp/cello && git checkout v0.8.0-beta
RUN cp -r /tmp/cello/user-dashboard/js /app
RUN mkdir -p /usr/app
RUN cp -r /tmp/cello/user-dashboard /usr/app/src
RUN cd /app/home && npm install --loglevel http && npm run build

FROM node:9.2 as build_dashboard
MAINTAINER haitao yue "hightall@me.com"
RUN cd /tmp && git clone https://github.com/hyperledger/cello.git
RUN cd /tmp/cello && git checkout v0.8.0-beta
RUN cp -r /tmp/cello/user-dashboard/js /app
RUN mkdir -p /usr/app
RUN cp -r /tmp/cello/user-dashboard /usr/app/src
RUN cd /app/dashboard && npm install --loglevel http && npm run build

FROM node:9.2
MAINTAINER haitao yue "hightall@me.com"
RUN npm install -g requirejs
RUN cd /tmp && git clone https://github.com/hyperledger/cello.git
RUN cd /tmp/cello && git checkout v0.8.0-beta
COPY package.json /
RUN cd / && yarn install -g --verbose
ENV PATH ${PATH}:/node_modules/.bin
RUN mkdir -p /usr/app
RUN cp -r /tmp/cello/user-dashboard /usr/app/src
WORKDIR /usr/app/src
ENV FABRIC_VERSION 1.0.5
RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && mv bin/configtxgen /usr/local/bin/configtxgen
RUN mkdir -p /etc/hyperledger
RUN cp -r /tmp/cello/user-dashboard/fabric/fabric /etc/hyperledger/fabric
COPY --from=build_login /usr/app/src/src/public/js/dist /usr/app/src/src/public/js/dist
COPY --from=build_home /usr/app/src/src/public/js/dist /usr/app/src/src/public/js/dist
COPY --from=build_dashboard /usr/app/src/src/public/js/dist /usr/app/src/src/public/js/dist
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
EXPOSE 8080
CMD ["npm", "start"]
59 changes: 59 additions & 0 deletions dockerhub/v0.8.0-beta/user-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "bc-dashboard",
"version": "1.0.0",
"description": "It is the nodeJS version of blockchain dashboard",
"main": "dist",
"dependencies": {
"body-parser": "^1.17.1",
"cookie-parser": "^1.4.3",
"express": "^4.15.2",
"express-session": "^1.15.2",
"gridfs-stream": "^1.1.1",
"mongodb": "^2.2.26",
"mongoose": "^4.13.2",
"multer": "^1.3.0",
"multer-gridfs-storage": "^1.1.1",
"node-uuid": "^1.4.8",
"pug": "^2.0.0-rc.1",
"winston": "^2.3.1",
"request": "^2.81.0",
"consolidate": "^0.14.5",
"swig": "^1.4.2",
"cors": "^2.8.4",
"nodemailer": "^4.2.0",
"socket.io": "^2.0.4",
"moment": "^2.19.1",
"moment-range": "^3.0.3",
"fabric-client": "^1.0.2",
"fabric-ca-client": "^1.0.2",
"log4js": "^0.6.38",
"uuid4": "^1.0.0",
"fs-extra": "^4.0.2",
"express-bearer-token": "^2.1.0",
"express-jwt": "^5.1.0",
"jsonwebtoken": "^7.3.0",
"shelljs": "^0.7.8",
"jsonfile": "^4.0.0",
"rimraf": "^2.6.2",
"express-request-language": "^1.1.15",
"sleep-promise": "^2.0.0",
"request-promise": "^4.2.0"
},
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"babel-plugin-transform-runtime": "^6.0.0",
"eslint": "^3.1.1",
"pm2": "^2.9.1",
"nodemon": "^1.12.1"
},
"scripts": {
"start": "pm2 --interpreter babel-node start src/index.js --no-daemon",
"build": "babel src -s --ignore src/public -D -d dist && cp -r src/public dist/",
"dev": "pm2 --interpreter babel-node start src/index.js --no-daemon --watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "hightall",
"license": "ISC"
}
16 changes: 1 addition & 15 deletions dockerhub/v0.8.0-beta/watchdog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@
# SPDX-License-Identifier: Apache-2.0
#
FROM hyperledger/cello-baseimage:x86_64-0.8.0-beta
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"]


CMD ["python", "watchdog.py"]
20 changes: 0 additions & 20 deletions dockerhub/v0.8.0-beta/watchdog/requirements.txt

This file was deleted.

0 comments on commit f1ed1ce

Please sign in to comment.