Skip to content

Commit

Permalink
[CE-355] Add user-dashboard docker build locally
Browse files Browse the repository at this point in the history
Support docker build locally for user-dashboard.

Change-Id: I6a083af3b6e194ca8e5647cd411bfbb0a9aec9b9
Signed-off-by: Haitao Yue <[email protected]>
  • Loading branch information
hightall committed May 8, 2018
1 parent e206242 commit a7d098f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ else
endif

# Docker images needed to run cello services
DOCKER_IMAGES = baseimage mongo nginx operator-dashboard ansible-agent
DOCKER_IMAGES = baseimage mongo nginx operator-dashboard ansible-agent user-dashboard
DUMMY = .$(IMG_TAG)

ifeq ($(DOCKER_BASE), )
Expand Down Expand Up @@ -104,6 +104,7 @@ build/docker/nginx/$(DUMMY): build/docker/nginx/$(DUMMY)
build/docker/mongo/$(DUMMY): build/docker/mongo/$(DUMMY)
build/docker/operator-dashboard/$(DUMMY): build/docker/operator-dashboard/$(DUMMY)
build/docker/ansible-agent/$(DUMMY): build/docker/ansible-agent/$(DUMMY)
build/docker/user-dashboard/$(DUMMY): build/docker/user-dashboard/$(DUMMY)

build/docker/%/$(DUMMY): ##@Build an image locally
$(eval TARGET = ${patsubst build/docker/%/$(DUMMY),%,${@}})
Expand Down
41 changes: 41 additions & 0 deletions docker/user-dashboard/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM node:8.9 as build_login
MAINTAINER haitao yue "[email protected]"
COPY . /tmp/cello
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:8.9 as build_home
MAINTAINER haitao yue "[email protected]"
COPY . /tmp/cello
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:8.9 as build_dashboard
MAINTAINER haitao yue "[email protected]"
COPY . /tmp/cello
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:8.9
MAINTAINER haitao yue "[email protected]"
RUN npm install -g requirejs
COPY . /tmp/cello
COPY user-dashboard/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
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
EXPOSE 8080
CMD ["npm", "start"]

0 comments on commit a7d098f

Please sign in to comment.