Skip to content

Commit

Permalink
Add a rpms target to docker/go-el7 Makefile
Browse files Browse the repository at this point in the history
Just a convenience target for getting the built golang RPMs
out of the container for use elsewhere.
  • Loading branch information
mjmac committed Mar 22, 2017
1 parent 7d31e58 commit 266c45c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packaging/docker/go-el7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ REPO ?= $(notdir $(CURDIR))

IMAGE := $(shell latest=$$(docker images | awk "/$(REPO).*$(FEDORA_GOLANG)/ {print \$$2}"); if [ "$$latest" == $(FEDORA_GOLANG) ]; then true; else echo $(REPO)/$(FEDORA_GOLANG); fi)

RPM_OUT := $(dir $(dir $(CURDIR)))output-go-$(FEDORA_GOLANG)

$(FEDORA_GOLANG): $(IMAGE)

rpms: $(RPM_OUT)
@echo "Copying built RPMs to $(RPM_OUT)..."
@docker run --rm -v $(RPM_OUT):/out:z $(REPO):latest sh -c 'cp -a /root/rpmbuild/RPMS/* /out'
@echo "Copied go-$(FEDORA_GOLANG) RPMs to $(RPM_OUT)"

$(RPM_OUT): $(IMAGE)
@rm -fr $@ && mkdir -p $@

$(IMAGE): Dockerfile
@echo "Building $(IMAGE) for $(FEDORA_GOLANG)"
docker build -t $(subst /,:,$(IMAGE)) -t $(REPO):latest --build-arg=go_version=$(FEDORA_GOLANG) --build-arg=go_macros_version=$(FEDORA_GOLANG_MACROS) $(BUILD_VARS) .
Expand Down

0 comments on commit 266c45c

Please sign in to comment.