From 4301e41b94679a5ecf95ed373130ac1f1d4a2cb2 Mon Sep 17 00:00:00 2001 From: Gregory Haskins Date: Thu, 26 Jan 2017 21:23:17 -0500 Subject: [PATCH] [FAB-1652] Switch runtime to baseos The peer/orderer containers are currently built on a custom busybox base we call "runtime". This results in superbly small images (~25MB each). However, it was discovered that we also inadvertently broke DNS/gethostbyname() functions in glibc as a result of doing this. It was decided that the busybox path, while small, was not a tenable solution for the long term. Therefore, we split the baseimage up into three pieces: baseos, basejvm, and (the original) baseimage. BaseOS gives us a relatively small os (64MB compressed for release x86_64-0.3.0) but without the problematic DNS/glibc issues. Therefore, this patch removes our custom busybox build from fabric.git and instead builds the peer/orderer from hyperledger/fabric-baseos, which is now available in dockerhub. This has the side benefit of also speeding up the build since we no longer need to compile busybox. Change-Id: I0dd1c61ea5afd10402cf6830f8fc605378a259a7 Signed-off-by: Greg Haskins --- .baseimage-release | 2 +- Makefile | 12 +----------- busybox/Makefile | 27 --------------------------- images/orderer/Dockerfile.in | 2 +- images/peer/Dockerfile.in | 2 +- images/runtime/Dockerfile.in | 6 ------ 6 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 busybox/Makefile delete mode 100644 images/runtime/Dockerfile.in diff --git a/.baseimage-release b/.baseimage-release index ee1372d33a2..0d91a54c7d4 100644 --- a/.baseimage-release +++ b/.baseimage-release @@ -1 +1 @@ -0.2.2 +0.3.0 diff --git a/Makefile b/Makefile index 37237ac6a89..2de3bb702f2 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ PROTOS = $(shell git ls-files *.proto | grep -v vendor) MSP_SAMPLECONFIG = $(shell git ls-files msp/sampleconfig/*.pem) GENESIS_SAMPLECONFIG = $(shell git ls-files common/configtx/test/*.template) PROJECT_FILES = $(shell git ls-files) -IMAGES = peer orderer ccenv javaenv testenv runtime zookeeper kafka +IMAGES = peer orderer ccenv javaenv testenv zookeeper kafka pkgmap.peer := $(PKGNAME)/peer pkgmap.orderer := $(PKGNAME)/orderer @@ -153,19 +153,10 @@ build/docker/gotools: gotools/Makefile hyperledger/fabric-baseimage:$(BASE_DOCKER_TAG) \ make install BINDIR=/opt/gotools/bin OBJDIR=/opt/gotools/obj -build/docker/busybox: - @$(DRUN) \ - hyperledger/fabric-baseimage:$(BASE_DOCKER_TAG) \ - make -f busybox/Makefile install BINDIR=$(@D) - # Both peer and peer-docker depend on ccenv and javaenv (all docker env images it supports). build/bin/peer: build/image/ccenv/$(DUMMY) build/image/javaenv/$(DUMMY) build/image/peer/$(DUMMY): build/image/ccenv/$(DUMMY) build/image/javaenv/$(DUMMY) -# Both peer-docker and orderer-docker depend on the runtime image -build/image/peer/$(DUMMY): build/image/runtime/$(DUMMY) -build/image/orderer/$(DUMMY): build/image/runtime/$(DUMMY) - build/bin/%: $(PROJECT_FILES) @mkdir -p $(@D) @echo "$@" @@ -194,7 +185,6 @@ build/image/testenv/payload: build/gotools.tar.bz2 \ peer/core.yaml \ build/msp-sampleconfig.tar.bz2 \ images/testenv/install-softhsm2.sh -build/image/runtime/payload: build/docker/busybox build/image/zookeeper/payload: images/zookeeper/docker-entrypoint.sh build/image/kafka/payload: images/kafka/docker-entrypoint.sh diff --git a/busybox/Makefile b/busybox/Makefile deleted file mode 100644 index 444cb73a809..00000000000 --- a/busybox/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -BUSYBOX_VER=1.25.1 -BUSYBOX_URL=https://www.busybox.net/downloads/busybox-$(BUSYBOX_VER).tar.bz2 - -OBJDIR=/tmp/busybox-$(BUSYBOX_VER) - -all: $(OBJDIR)/busybox - -install: $(BINDIR)/busybox - -$(BINDIR)/busybox: $(OBJDIR)/busybox - mkdir -p $(@D) - cp $< $@ - -$(OBJDIR)/.source: - mkdir -p $(@D) - curl -L $(BUSYBOX_URL) | (cd $(@D); tar --strip-components=1 -jx) - touch $@ - -$(OBJDIR)/.config: $(OBJDIR)/.source - make -C $(@D) defconfig - -$(OBJDIR)/busybox: Makefile $(OBJDIR)/.config - make -C $(@D) -l 2.5 -j all LDFLAGS=-static - -clean: - -rm -rf $(OBJDIR) - diff --git a/images/orderer/Dockerfile.in b/images/orderer/Dockerfile.in index 37e9625565d..a627568caa1 100644 --- a/images/orderer/Dockerfile.in +++ b/images/orderer/Dockerfile.in @@ -1,4 +1,4 @@ -FROM hyperledger/fabric-runtime:_TAG_ +FROM hyperledger/fabric-baseos:_BASE_TAG_ ENV ORDERER_CFG_PATH /etc/hyperledger/fabric/orderer RUN mkdir -p /var/hyperledger/db /etc/hyperledger/fabric/orderer COPY payload/orderer /usr/local/bin diff --git a/images/peer/Dockerfile.in b/images/peer/Dockerfile.in index c15695dd4e6..65f3defdbe1 100644 --- a/images/peer/Dockerfile.in +++ b/images/peer/Dockerfile.in @@ -1,4 +1,4 @@ -FROM hyperledger/fabric-runtime:_TAG_ +FROM hyperledger/fabric-baseos:_BASE_TAG_ ENV PEER_CFG_PATH /etc/hyperledger/fabric RUN mkdir -p /var/hyperledger/db $PEER_CFG_PATH COPY payload/peer /usr/local/bin diff --git a/images/runtime/Dockerfile.in b/images/runtime/Dockerfile.in deleted file mode 100644 index 1691ad0a479..00000000000 --- a/images/runtime/Dockerfile.in +++ /dev/null @@ -1,6 +0,0 @@ -FROM scratch -COPY payload/busybox /bin/busybox -RUN ["/bin/busybox", "mkdir", "-p", "/usr/bin", "/sbin", "/usr/sbin"] -RUN ["/bin/busybox", "--install"] -RUN mkdir -p /usr/local/bin -ENV PATH=$PATH:/usr/local/bin