Skip to content

Commit

Permalink
[FAB-4828] Make docker namespace configurable
Browse files Browse the repository at this point in the history
Changed Makefile to use DOCKER_NS and BASE_DOCKER_NS
like fabric Makefile. This makes namespace overridable
by the users.

Change-Id: I2e7a144d80036fc8b51c38a467dd4656598ee1d4
Signed-off-by: Anil Ambati <[email protected]>
  • Loading branch information
Anil Ambati committed Dec 13, 2017
1 parent 1c6ef12 commit 25c2411
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 3 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ GO_SOURCE := $(shell find . -name '*.go')
GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/lib/metadata.%,$(METADATA_VAR))
export GO_LDFLAGS

DOCKER_ORG = hyperledger
IMAGES = $(PROJECT_NAME) $(PROJECT_NAME)-orderer $(PROJECT_NAME)-peer $(PROJECT_NAME)-tools
FVTIMAGE = $(PROJECT_NAME)-fvt

Expand Down Expand Up @@ -120,19 +119,13 @@ build/docker/bin/%:
@$(DRUN) \
-v $(abspath build/docker/bin):/opt/gopath/bin \
-v $(abspath build/docker/$(@F)/pkg):/opt/gopath/pkg \
hyperledger/fabric-baseimage:$(BASE_DOCKER_TAG) \
$(BASE_DOCKER_NS)/fabric-baseimage:$(BASE_DOCKER_TAG) \
go install -ldflags "$(DOCKER_GO_LDFLAGS)" $(PKGNAME)/$(path-map.${@F})
@touch $@

build/docker/busybox:
@echo "Building $@"
@$(DRUN) \
hyperledger/fabric-baseimage:$(BASE_DOCKER_TAG) \
make -f busybox/Makefile install BINDIR=$(@D)

build/image/%/$(DUMMY): Makefile build/image/%/payload
$(eval TARGET = ${patsubst build/image/%/$(DUMMY),%,${@}})
$(eval DOCKER_NAME = $(DOCKER_ORG)/$(TARGET))
$(eval DOCKER_NAME = $(DOCKER_NS)/$(TARGET))
@echo "Building docker $(TARGET) image"
@cat images/$(TARGET)/Dockerfile.in \
| sed -e 's/_BASE_TAG_/$(BASE_DOCKER_TAG)/g' \
Expand Down Expand Up @@ -218,7 +211,7 @@ ci-tests: docker-clean docker-fvt unit-tests docs

%-docker-clean:
$(eval TARGET = ${patsubst %-docker-clean,%,${@}})
-docker images -q $(DOCKER_ORG)/$(TARGET):latest | xargs -I '{}' docker rmi -f '{}'
-docker images -q $(DOCKER_NS)/$(TARGET):latest | xargs -I '{}' docker rmi -f '{}'
-@rm -rf build/image/$(TARGET) ||:

docker-clean: $(patsubst %,%-docker-clean, $(IMAGES) $(PROJECT_NAME)-fvt)
Expand Down
5 changes: 4 additions & 1 deletion docker-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ DRUN = docker run -i --rm $(DOCKER_RUN_FLAGS) \

DBUILD = docker build $(DOCKER_BUILD_FLAGS)

DOCKER_TAG=$(ARCH)-$(PROJECT_VERSION)
BASE_DOCKER_NS ?= hyperledger
BASE_DOCKER_TAG=$(ARCH)-$(BASEIMAGE_RELEASE)

DOCKER_NS ?= hyperledger
DOCKER_TAG=$(ARCH)-$(PROJECT_VERSION)

DOCKER_GO_LDFLAGS += $(GO_LDFLAGS)
ifeq ($(FABRIC_CA_DYNAMIC_LINK),true)
DOCKER_GO_LDFLAGS += -linkmode external -extldflags '-lpthread'
Expand Down

0 comments on commit 25c2411

Please sign in to comment.