From 92c32cb41831f49a8a483e0a90cafd5dc8982f79 Mon Sep 17 00:00:00 2001 From: Jose Bigio Date: Wed, 5 Sep 2018 17:01:23 -0700 Subject: [PATCH 1/2] Move the tar creation to the image directory Signed-off-by: Jose Bigio (cherry picked from commit eba0ed1f3497ebf25666d96c73c71fde9de98b50) Signed-off-by: Jose Bigio Upstream-commit: 9398be8a7b9ea3907de5c112c329fe3ef1832137 Component: packaging --- components/packaging/deb/Makefile | 18 ++---------------- components/packaging/image/Makefile | 17 +++++++++++++++-- components/packaging/rpm/Makefile | 18 ++---------------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index dd800b3b4f..fd4b049598 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -156,21 +156,7 @@ sources/dockerd.json: ../common/dockerd.json -e 's/$${IMAGE_TAG}/$(IMAGE_TAG)/' \ $< > $@ -# TODO: Eventually clean this up when we release an image with a manifest -DOCKER2OCI=artifacts/docker2oci -$(DOCKER2OCI): - -$(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - docker run --name docker2oci $(GO_IMAGE) sh -c 'go get github.com/coolljt0725/docker2oci' - mkdir -p $(@D) - docker cp docker2oci:/go/bin/docker2oci "$@" - docker rm -f docker2oci - $(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - # offline bundle sources/engine.tar: $(DOCKER2OCI) - $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) image-linux - mkdir -p artifacts - docker save -o artifacts/docker-engine.tar $$(cat ../image/image-linux) - ./$(DOCKER2OCI) -i artifacts/docker-engine.tar artifacts/engine-image - mkdir -p $(@D) - tar c -C artifacts/engine-image . > $@ + $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH) + tar c -C ../engine-$(ARCH) . > $@ diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 8165fa5ab7..71ffa63864 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -9,6 +9,7 @@ STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) DOCKER_HUB_ORG?=dockereng ARCH=$(shell uname -m) ENGINE_IMAGE?=engine-community +CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown DEFAULT_PRODUCT_LICENSE?=Community Engine .PHONY: help @@ -42,9 +43,21 @@ image-linux: $(ENGINE_DIR)/Dockerfile.engine --file $< $(ENGINE_DIR) echo $(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION).$(ARCH) > $@ -engine-$(ARCH).tar: image-linux - docker save -o $@ $$(cat $<) +DOCKER2OCI=artifacts/docker2oci +$(DOCKER2OCI): + -$(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) + docker run --name docker2oci $(GO_IMAGE) sh -c 'go get github.com/coolljt0725/docker2oci' + mkdir -p $(@D) + docker cp docker2oci:/go/bin/docker2oci "$@" + docker rm -f docker2oci + $(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) +engine-$(ARCH).tar: image-linux $(DOCKER2OCI) + mkdir -p artifacts + docker save -o artifacts/docker-engine.tar $$(cat image-linux) + ./$(DOCKER2OCI) -i artifacts/docker-engine.tar artifacts/engine-image + mkdir -p $(@D) + tar c -C artifacts/engine-image . > $@ .PHONY: release release: diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index a6157c1c5c..bcd07fa53f 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -123,21 +123,7 @@ rpmbuild/SOURCES/dockerd.json: ../common/dockerd.json -e 's/$${IMAGE_TAG}/$(IMAGE_TAG)/' \ $< > $@ -# TODO: Eventually clean this up when we release an image with a manifest -DOCKER2OCI=artifacts/docker2oci -$(DOCKER2OCI): - -$(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - docker run --name docker2oci $(GO_IMAGE) sh -c 'go get github.com/coolljt0725/docker2oci' - mkdir -p $(@D) - docker cp docker2oci:/go/bin/docker2oci "$@" - docker rm -f docker2oci - $(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - # offline bundle rpmbuild/SOURCES/engine.tar: $(DOCKER2OCI) - $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) image-linux - mkdir -p artifacts - docker save -o artifacts/docker-engine.tar $$(cat ../image/image-linux) - ./$(DOCKER2OCI) -i artifacts/docker-engine.tar artifacts/engine-image - mkdir -p $(@D) - tar c -C artifacts/engine-image . > $@ + $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH) + tar c -C ../image/engine-$(ARCH) . > $@ From 00ef8b90e696b7a518a45886d0db57d8c640d12d Mon Sep 17 00:00:00 2001 From: Jose Bigio Date: Thu, 6 Sep 2018 11:33:33 -0700 Subject: [PATCH 2/2] Call the engine-.tar target Also cleans up the target in rpm and deb Makfiles because the tar target already output a tar. Signed-off-by: Jose Bigio (cherry picked from commit 8a4744f48aa13bea0b4e9174165be4add0a5a42f) Signed-off-by: Jose Bigio Upstream-commit: 8e4a92dc667e2143b6d5707e19c5564b7da46ba1 Component: packaging --- components/packaging/deb/Makefile | 6 +++--- components/packaging/image/Makefile | 2 +- components/packaging/rpm/Makefile | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index fd4b049598..9e0c2d4e10 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -157,6 +157,6 @@ sources/dockerd.json: ../common/dockerd.json $< > $@ # offline bundle -sources/engine.tar: $(DOCKER2OCI) - $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH) - tar c -C ../engine-$(ARCH) . > $@ +sources/engine.tar: + $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH).tar + mv ../image/engine-$(ARCH).tar $@ diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 71ffa63864..2f5b2f825b 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -46,7 +46,7 @@ image-linux: $(ENGINE_DIR)/Dockerfile.engine DOCKER2OCI=artifacts/docker2oci $(DOCKER2OCI): -$(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - docker run --name docker2oci $(GO_IMAGE) sh -c 'go get github.com/coolljt0725/docker2oci' + docker run --name docker2oci $(ENGINE_GO_IMAGE) sh -c 'go get github.com/coolljt0725/docker2oci' mkdir -p $(@D) docker cp docker2oci:/go/bin/docker2oci "$@" docker rm -f docker2oci diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index bcd07fa53f..e9b44ec8b3 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -124,6 +124,6 @@ rpmbuild/SOURCES/dockerd.json: ../common/dockerd.json $< > $@ # offline bundle -rpmbuild/SOURCES/engine.tar: $(DOCKER2OCI) - $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH) - tar c -C ../image/engine-$(ARCH) . > $@ +rpmbuild/SOURCES/engine.tar: + $(MAKE) -C ../image ENGINE_IMAGE=$(ENGINE_IMAGE) ENGINE_SCOPE=$(ENGINE_SCOPE) engine-$(ARCH).tar + mv ../image/engine-$(ARCH).tar $@