From 126bb1b3a0f45011a0f155c99f1ad719e63075f1 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Fri, 17 Aug 2018 18:33:02 +0000 Subject: [PATCH] Add some changes to make things more configurable Allows us to switch out debian files and rpm specs on the fly and also gives us an out to have ARCH specific dockerfiles if we need them for RPM's. The same strategy can be used for DEB's if need be Signed-off-by: Eli Uriegas Upstream-commit: b72dc2edb8329151bfe2df6989fb329f41e720fb Component: packaging --- components/packaging/deb/Makefile | 4 +++- components/packaging/deb/debian-buster/Dockerfile | 3 ++- components/packaging/deb/debian-jessie/Dockerfile | 3 ++- components/packaging/deb/debian-stretch/Dockerfile | 3 ++- components/packaging/deb/raspbian-jessie/Dockerfile | 3 ++- components/packaging/deb/raspbian-stretch/Dockerfile | 3 ++- components/packaging/deb/ubuntu-bionic/Dockerfile | 3 ++- components/packaging/deb/ubuntu-trusty/Dockerfile | 3 ++- components/packaging/deb/ubuntu-xenial/Dockerfile | 3 ++- components/packaging/rpm/Makefile | 12 ++++++++++-- 10 files changed, 29 insertions(+), 11 deletions(-) diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index 4dba9fd2b7..7a9a6b8f0e 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -12,8 +12,10 @@ DEB_VERSION=$(shell ./gen-deb-ver $(CLI_DIR) "$(VERSION)") CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown EPOCH?=2 -BUILD=docker build \ +COMMON_FILES=common +BUILD?=docker build \ --build-arg GO_IMAGE=$(GO_IMAGE) \ + --build-arg COMMON_FILES=$(COMMON_FILES) \ -t debbuild-$@/$(ARCH) \ -f $(CURDIR)/$@/Dockerfile . RUN=docker run --rm -i \ diff --git a/components/packaging/deb/debian-buster/Dockerfile b/components/packaging/deb/debian-buster/Dockerfile index 9f6b1b6691..7f2613f45b 100644 --- a/components/packaging/deb/debian-buster/Dockerfile +++ b/components/packaging/deb/debian-buster/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/debian-jessie/Dockerfile b/components/packaging/deb/debian-jessie/Dockerfile index 331e82cec5..03a7ce4cc8 100644 --- a/components/packaging/deb/debian-jessie/Dockerfile +++ b/components/packaging/deb/debian-jessie/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/debian-stretch/Dockerfile b/components/packaging/deb/debian-stretch/Dockerfile index bb482d8d07..3037785979 100644 --- a/components/packaging/deb/debian-stretch/Dockerfile +++ b/components/packaging/deb/debian-stretch/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/raspbian-jessie/Dockerfile b/components/packaging/deb/raspbian-jessie/Dockerfile index f218093e21..15bf9a3ea4 100644 --- a/components/packaging/deb/raspbian-jessie/Dockerfile +++ b/components/packaging/deb/raspbian-jessie/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/raspbian-stretch/Dockerfile b/components/packaging/deb/raspbian-stretch/Dockerfile index d574ae64a2..3b2cbe8800 100644 --- a/components/packaging/deb/raspbian-stretch/Dockerfile +++ b/components/packaging/deb/raspbian-stretch/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/ubuntu-bionic/Dockerfile b/components/packaging/deb/ubuntu-bionic/Dockerfile index 690d71629a..61dfde41c1 100644 --- a/components/packaging/deb/ubuntu-bionic/Dockerfile +++ b/components/packaging/deb/ubuntu-bionic/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/ubuntu-trusty/Dockerfile b/components/packaging/deb/ubuntu-trusty/Dockerfile index d0681457f5..b21b674dc9 100644 --- a/components/packaging/deb/ubuntu-trusty/Dockerfile +++ b/components/packaging/deb/ubuntu-trusty/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/deb/ubuntu-xenial/Dockerfile b/components/packaging/deb/ubuntu-xenial/Dockerfile index 7814ab982b..f728407ca0 100644 --- a/components/packaging/deb/ubuntu-xenial/Dockerfile +++ b/components/packaging/deb/ubuntu-xenial/Dockerfile @@ -11,7 +11,8 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV DOCKER_BUILDTAGS apparmor pkcs11 seccomp selinux ENV RUNC_BUILDTAGS apparmor seccomp selinux -COPY common/ /root/build-deb/debian +ARG COMMON_FILES +COPY ${COMMON_FILES} /root/build-deb/debian RUN mk-build-deps -t "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" -i /root/build-deb/debian/control # Copy our sources and untar them diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index d94f7a5342..e250cc395f 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -10,7 +10,15 @@ GO_VERSION:=1.10.3 GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION) GEN_RPM_VER=$(shell ./gen-rpm-ver $(CLI_DIR) $(VERSION)) CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown -BUILD=docker build --build-arg GO_IMAGE=$(GO_IMAGE) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile . + +DOCKERFILE=Dockerfile +ifdef NEEDS_ARCH_SPECIFIC + DOCKERFILE=Dockerfile.$(ARCH) +endif +BUILD=docker build --build-arg GO_IMAGE=$(GO_IMAGE) -t rpmbuild-$@/$(ARCH) -f $@/$(DOCKERFILE) . + +SPEC_FILES=docker-ce.spec docker-ce-cli.spec +SPECS=$(addprefix SPECS/, $(SPEC_FILES)) RPMBUILD=docker run --privileged --rm -i\ -v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES \ -v $(CURDIR)/rpmbuild/RPMS:/root/rpmbuild/RPMS \ @@ -20,7 +28,7 @@ RPMBUILD_FLAGS=-ba\ --define '_release $(word 2,$(GEN_RPM_VER))' \ --define '_version $(word 1,$(GEN_RPM_VER))' \ --define '_origversion $(word 4, $(GEN_RPM_VER))' \ - SPECS/docker-ce.spec SPECS/docker-ce-cli.spec + $(SPECS) RUN=$(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) SOURCE_FILES=containerd-proxy.tgz cli.tgz containerd-shim-process.tar docker.service dockerd.json