Skip to content

Commit

Permalink
[CE-678] Add dockerhub files for common,agent images
Browse files Browse the repository at this point in the history
For common, agents images add dockerfiles.

Change-Id: Ibe0f848bfab269f74e79696f91c4eb0bbf5b9c0b
Signed-off-by: Haitao Yue <[email protected]>
  • Loading branch information
hightall committed Aug 18, 2019
1 parent 27875fe commit c9653ed
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 132 deletions.
10 changes: 10 additions & 0 deletions .makerc/functions
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ define build_docker_locally
. ;
@touch $@ ;
endef

define build_docker_hub
dir=$*; \
IMG=hyperledger/$(2)-$$dir; \
echo "Building $$IMG"; \
docker build \
-t $$IMG \
-t $$IMG:x86_64-latest \
build_image/dockerhub/latest/$(1)/$$dir
endef
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,21 @@ agent-docker-%:

docker-clean: stop image-clean ##@Clean all existing images

DOCKERHUB_IMAGES = baseimage engine operator-dashboard user-dashboard watchdog ansible-agent parse-server

dockerhub: $(patsubst %,dockerhub-%,$(DOCKERHUB_IMAGES)) ##@Building latest docker images as hosted in dockerhub

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 \
build_image/dockerhub/latest/$$dir
DOCKERHUB_COMMON_IMAGES = api-engine dashboard

dockerhub-common: $(patsubst %,dockerhub-common-%,$(DOCKERHUB_COMMON_IMAGES)) ##@Building latest docker images as hosted in dockerhub

dockerhub-common-%: ##@Building latest images with dockerhub materials, to valid them
$(call build_docker_hub,common,$(BASENAME))

DOCKERHUB_AGENT_IMAGES = ansible kubernetes

dockerhub-agent: $(patsubst %,dockerhub-agent-%,$(DOCKERHUB_AGENT_IMAGES)) ##@Building latest docker images as hosted in dockerhub

dockerhub-agent-%: ##@Building latest images with dockerhub materials, to valid them
$(call build_docker_hub,agent,$(AGENT_BASENAME))

dockerhub: dockerhub-common dockerhub-agent

dockerhub-pull: ##@Pull service images from dockerhub
cd scripts/master_node && bash download_images.sh
Expand Down
22 changes: 22 additions & 0 deletions build_image/dockerhub/latest/agent/kubernetes/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM busybox as downloader

RUN cd /tmp && wget -c https://github.com/hyperledger/cello/archive/master.zip && \
unzip master.zip

FROM python:3.6

LABEL maintainer="github.com/hyperledger/cello"

COPY --from=downloader /tmp/cello-master/src/agent/kubernetes-agent/requirements.txt /
RUN pip install -r /requirements.txt
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && \
mv kubectl /usr/local/bin/kubectl

COPY --from=downloader /tmp/cello-master/src/agent/kubernetes-agent/src /app

WORKDIR /app

ENV KUBECONFIG /app/.kube/config
ENV PYTHONPATH /app:$PATHONPATH

CMD python main.py
21 changes: 0 additions & 21 deletions build_image/dockerhub/latest/baseimage/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions build_image/dockerhub/latest/baseimage/install.sh

This file was deleted.

25 changes: 25 additions & 0 deletions build_image/dockerhub/latest/common/api-engine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM busybox as downloader

RUN cd /tmp && wget -c https://github.com/hyperledger/cello/archive/master.zip && \
unzip master.zip

FROM python:3.6

LABEL maintainer="github.com/hyperledger/cello"

RUN apt-get update && apt-get install -y gettext-base graphviz libgraphviz-dev && \
apt-get autoclean && apt-get clean && apt-get autoremove && rm -rf /var/cache/apt/
COPY --from=downloader /tmp/cello-master/src/api-engine/requirements.txt /
RUN cd / && \
pip install -r requirements.txt

COPY --from=downloader /tmp/cello-master/src/api-engine /var/www/server
COPY --from=downloader /tmp/cello-master/src/api-engine/docker/uwsgi/server.ini /etc/uwsgi/apps-enabled/
COPY --from=downloader /tmp/cello-master/src/api-engine/docker/scripts /scripts
COPY --from=downloader /tmp/cello-master/build_image/docker/common/api-engine/entrypoint.sh /

RUN cd /var/www/server/api_engine && cp settings.py.initial settings.py && cd .. && python manage.py collectstatic --noinput

WORKDIR /var/www/server

CMD bash /entrypoint.sh
26 changes: 26 additions & 0 deletions build_image/dockerhub/latest/common/dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM busybox as downloader

RUN cd /tmp && wget -c https://github.com/hyperledger/cello/archive/master.zip && \
unzip master.zip

FROM circleci/node:latest-browsers as builder

LABEL maintainer="github.com/hyperledger/cello"

WORKDIR /usr/src/app/
USER root
COPY --from=downloader /tmp/cello-master/src/dashboard/package.json ./
RUN yarn
COPY --from=downloader /tmp/cello-master/src/dashboard ./
RUN npm run build

FROM nginx:1.15.12

COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY --from=downloader /tmp/cello-master/build_image/docker/common/dashboard/config-nginx.sh /
RUN chmod +x /config-nginx.sh
COPY --from=downloader /tmp/cello-master/build_image/docker/common/dashboard/default.conf.tmpl /etc/nginx/conf.d/default.conf.tmpl

EXPOSE 80

CMD ["bash", "-c", "/config-nginx.sh && nginx -g 'daemon off;'"]
12 changes: 0 additions & 12 deletions build_image/dockerhub/latest/engine/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions build_image/dockerhub/latest/operator-dashboard/Dockerfile

This file was deleted.

12 changes: 0 additions & 12 deletions build_image/dockerhub/latest/parse-server/Dockerfile

This file was deleted.

40 changes: 0 additions & 40 deletions build_image/dockerhub/latest/user-dashboard/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions build_image/dockerhub/latest/watchdog/Dockerfile

This file was deleted.

0 comments on commit c9653ed

Please sign in to comment.