From fda74c4df83554ae2662184b4a5a1a1eaaf6927a Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Mon, 25 Mar 2019 20:01:45 +0000 Subject: [PATCH 1/2] RPM: build the daemon as part of the package Restores previous behavior when it comes to building the daemon plus its dependencies (docker-proxy, docker-init) Signed-off-by: Eli Uriegas --- rpm/Makefile | 23 ++++++---- rpm/SPECS/docker-ce.spec | 91 +++++++++++++++++++++------------------- rpm/centos-7/Dockerfile | 7 +--- rpm/fedora-27/Dockerfile | 7 +--- rpm/fedora-28/Dockerfile | 7 +--- rpm/fedora-29/Dockerfile | 7 +--- rpm/fedora-30/Dockerfile | 7 +--- 7 files changed, 68 insertions(+), 81 deletions(-) diff --git a/rpm/Makefile b/rpm/Makefile index 1ee7e2f4d4..5ee90ef4ec 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -5,6 +5,7 @@ ENGINE_DIR:=$(CURDIR)/../../engine CLI_DIR:=$(CURDIR)/../../cli GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD) VERSION?=0.0.0-dev +STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) GO_BASE_IMAGE=golang GO_VERSION:=1.11.5 GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION) @@ -21,7 +22,6 @@ endif BUILD?=docker build \ $(BUILD_IMAGE_FLAG) \ --build-arg GO_IMAGE=$(GO_IMAGE) \ - --build-arg ENGINE_IMAGE=$(shell cat rpmbuild/SOURCES/engine-image) \ -t rpmbuild-$@/$(ARCH) \ -f $@/$(DOCKERFILE) \ . @@ -40,10 +40,9 @@ RPMBUILD_FLAGS?=-ba\ $(SPECS) RUN?=$(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) -SOURCE_FILES=engine-image cli.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz +SOURCE_FILES=engine-image engine.tgz cli.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_FILES)) - .PHONY: help help: ## show make targets @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -84,6 +83,14 @@ centos-7: $(SOURCES) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild +rpmbuild/SOURCES/engine.tgz: + mkdir -p rpmbuild/SOURCES + docker run --rm -i -w /v \ + -v $(ENGINE_DIR):/engine \ + -v $(CURDIR)/rpmbuild/SOURCES:/v \ + alpine \ + tar -C / -c -z -f /v/engine.tgz --exclude .git engine + rpmbuild/SOURCES/cli.tgz: mkdir -p rpmbuild/SOURCES docker run --rm -i -w /v \ @@ -100,15 +107,17 @@ rpmbuild/SOURCES/docker.socket: ../systemd/docker.socket mkdir -p $(@D) cp $< $@ +# TODO: Figure out how to decouple this +# TODO: These might just end up being static files that are hardcoded +# TODO: FROM HERE <===================== rpmbuild/SOURCES/engine-image: - $(MAKE) -C ../image image-linux-dm mkdir -p $(@D) - cp ../image/image-linux-dm $@ + echo "docker.io/dockereng/engine-community-dm:$(STATIC_VERSION)" > $@ rpmbuild/SOURCES/distribution_based_engine.json: rpmbuild/SOURCES/engine-image mkdir -p $(@D) - docker inspect "$(shell cat $<)" \ - --format '{{index .Config.Labels "com.docker.distribution_based_engine" }}' > $@ + echo '{"platform":"Docker Engine - Community","engine_image":"engine-community-dm","containerd_min_version":"1.2.0-beta.1","runtime":"host_install"}' > $@ +# TODO: TO HERE <===================== rpmbuild/SOURCES/plugin-installers.tgz: $(wildcard ../plugins/*) docker run --rm -i -w /v \ diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index 424dd40522..4f91f44e45 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -5,8 +5,9 @@ Name: docker-ce Version: %{_version} Release: %{_release}%{?dist} Epoch: 3 -Source0: docker.service -Source1: docker.socket +Source0: engine.tgz +Source1: docker.service +Source2: docker.socket Summary: The open-source application container engine Group: Tools/Docker License: ASL 2.0 @@ -27,10 +28,25 @@ Requires: xz # Resolves: rhbz#1165615 Requires: device-mapper-libs >= 1.02.90-1 -BuildRequires: which -BuildRequires: make +BuildRequires: bash +BuildRequires: btrfs-progs-devel +BuildRequires: ca-certificates +BuildRequires: cmake +BuildRequires: device-mapper-devel BuildRequires: gcc +BuildRequires: git +BuildRequires: glibc-static +BuildRequires: libseccomp-devel +BuildRequires: libselinux-devel +BuildRequires: libtool +BuildRequires: libtool-ltdl-devel +BuildRequires: make +BuildRequires: pkgconfig BuildRequires: pkgconfig(systemd) +BuildRequires: selinux-policy-devel +BuildRequires: systemd-devel +BuildRequires: tar +BuildRequires: which # conflicting packages Conflicts: docker @@ -55,20 +71,42 @@ for deploying and scaling web apps, databases, and backend services without depending on a particular stack or provider. %prep +%setup -q -c -n src -a 0 %build +export DOCKER_GITCOMMIT=%{_gitcommit} +mkdir -p /go/src/github.com/docker +ln -s /root/rpmbuild/BUILD/src/engine /go/src/github.com/docker/docker + +pushd engine +for component in tini "proxy dynamic";do + TMP_GOPATH="/go" hack/dockerfile/install/install.sh $component +done +VERSION=%{_origversion} PRODUCT=docker hack/make.sh dynbinary +popd + +%check +engine/bundles/dynbinary-daemon/dockerd -v %install -# Install containerd-proxy as dockerd -install -D -m 0755 /sources/dockerd $RPM_BUILD_ROOT/%{_bindir}/dockerd-ce -install -D -m 0755 /sources/docker-proxy $RPM_BUILD_ROOT/%{_bindir}/docker-proxy -install -D -m 0755 /sources/docker-init $RPM_BUILD_ROOT/%{_bindir}/docker-init +# install daemon binary +install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) $RPM_BUILD_ROOT/%{_bindir}/dockerd + +# install proxy +install -D -p -m 0755 /usr/local/bin/docker-proxy $RPM_BUILD_ROOT/%{_bindir}/docker-proxy + +# install tini +install -D -p -m 755 /usr/local/bin/docker-init $RPM_BUILD_ROOT/%{_bindir}/docker-init + +# install systemd scripts install -D -m 0644 %{_topdir}/SOURCES/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service install -D -m 0644 %{_topdir}/SOURCES/docker.socket $RPM_BUILD_ROOT/%{_unitdir}/docker.socket + +# install json for docker engine activate / upgrade install -D -m 0644 %{_topdir}/SOURCES/distribution_based_engine.json $RPM_BUILD_ROOT/var/lib/docker-engine/distribution_based_engine-ce.json %files -/%{_bindir}/dockerd-ce +/%{_bindir}/dockerd /%{_bindir}/docker-proxy /%{_bindir}/docker-init /%{_unitdir}/docker.service @@ -94,51 +132,16 @@ fi if ! getent group docker > /dev/null; then groupadd --system docker fi -dbefile=/var/lib/docker-engine/distribution_based_engine.json -URL=https://docs.docker.com/releasenote -if [ -f "${dbefile}" ] && sed -e 's/.*"platform"[ \t]*:[ \t]*"\([^"]*\)".*/\1/g' "${dbefile}"| grep -v -i community > /dev/null; then - echo - echo - echo - echo "Warning: Your engine has been activated to Docker Engine - Enterprise but you are still using Community packages" - echo "You can use the 'docker engine update' command to update your system, or switch to using the Enterprise packages." - echo "See $URL for more details." - echo - echo - echo -else - rm -f %{_bindir}/dockerd - update-alternatives --install %{_bindir}/dockerd dockerd %{_bindir}/dockerd-ce 1 \ - --slave "${dbefile}" distribution_based_engine.json /var/lib/docker-engine/distribution_based_engine-ce.json -fi %preun %systemd_preun docker -update-alternatives --remove dockerd %{_bindir}/dockerd || true %postun %systemd_postun_with_restart docker %posttrans if [ $1 -ge 0 ] ; then - dbefile=/var/lib/docker-engine/distribution_based_engine.json - URL=https://docs.docker.com/releasenote - if [ -f "${dbefile}" ] && sed -e 's/.*"platform"[ \t]*:[ \t]*"\([^"]*\)".*/\1/g' "${dbefile}"| grep -v -i community > /dev/null; then - echo - echo - echo - echo "Warning: Your engine has been activated to Docker Engine - Enterprise but you are still using Community packages" - echo "You can use the 'docker engine update' command to update your system, or switch to using the Enterprise packages." - echo "See $URL for more details." - echo - echo - echo - else - rm -f %{_bindir}/dockerd - update-alternatives --install %{_bindir}/dockerd dockerd %{_bindir}/dockerd-ce 1 \ - --slave "${dbefile}" distribution_based_engine.json /var/lib/docker-engine/distribution_based_engine-ce.json - fi # package upgrade scenario, after new files are installed # check if docker was running before upgrade diff --git a/rpm/centos-7/Dockerfile b/rpm/centos-7/Dockerfile index c2485ef53b..8012ceef12 100644 --- a/rpm/centos-7/Dockerfile +++ b/rpm/centos-7/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=centos:7 FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} ENV DISTRO centos @@ -17,9 +15,6 @@ COPY SPECS /root/rpmbuild/SPECS # Overwrite repo that was failing on aarch64 RUN sed -i 's/altarch/centos/g' /etc/yum.repos.d/CentOS-Sources.repo RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec -COPY --from=golang /usr/local/go /usr/local/go/ -COPY --from=engine /bin/dockerd /sources/ -COPY --from=engine /bin/docker-proxy /sources/ -COPY --from=engine /bin/docker-init /sources/ +COPY --from=golang /usr/local/go /usr/local/go WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-27/Dockerfile b/rpm/fedora-27/Dockerfile index c4311f3dc4..1d2e45d090 100644 --- a/rpm/fedora-27/Dockerfile +++ b/rpm/fedora-27/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=fedora:27 FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} ENV DISTRO fedora @@ -15,9 +13,6 @@ ENV RUNC_BUILDTAGS seccomp selinux RUN dnf install -y rpm-build rpmlint dnf-plugins-core COPY SPECS /root/rpmbuild/SPECS RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec -COPY --from=golang /usr/local/go /usr/local/go/ -COPY --from=engine /bin/dockerd /sources/ -COPY --from=engine /bin/docker-proxy /sources/ -COPY --from=engine /bin/docker-init /sources/ +COPY --from=golang /usr/local/go /usr/local/go WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-28/Dockerfile b/rpm/fedora-28/Dockerfile index 39cd834696..9b781c8963 100644 --- a/rpm/fedora-28/Dockerfile +++ b/rpm/fedora-28/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=fedora:28 FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} ENV DISTRO fedora @@ -15,9 +13,6 @@ ENV RUNC_BUILDTAGS seccomp selinux RUN dnf install -y rpm-build rpmlint dnf-plugins-core COPY SPECS /root/rpmbuild/SPECS RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec -COPY --from=golang /usr/local/go /usr/local/go/ -COPY --from=engine /bin/dockerd /sources/ -COPY --from=engine /bin/docker-proxy /sources/ -COPY --from=engine /bin/docker-init /sources/ +COPY --from=golang /usr/local/go /usr/local/go WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-29/Dockerfile b/rpm/fedora-29/Dockerfile index 79e1604d08..b213c2b62e 100644 --- a/rpm/fedora-29/Dockerfile +++ b/rpm/fedora-29/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=fedora:29 FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} ENV DISTRO fedora @@ -15,9 +13,6 @@ ENV RUNC_BUILDTAGS seccomp selinux RUN dnf install -y rpm-build rpmlint dnf-plugins-core COPY SPECS /root/rpmbuild/SPECS RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec -COPY --from=golang /usr/local/go /usr/local/go/ -COPY --from=engine /bin/dockerd /sources/ -COPY --from=engine /bin/docker-proxy /sources/ -COPY --from=engine /bin/docker-init /sources/ +COPY --from=golang /usr/local/go /usr/local/go WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-30/Dockerfile b/rpm/fedora-30/Dockerfile index f56460d086..31ca45dc70 100644 --- a/rpm/fedora-30/Dockerfile +++ b/rpm/fedora-30/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=fedora:30 FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} ENV DISTRO fedora @@ -15,9 +13,6 @@ ENV RUNC_BUILDTAGS seccomp selinux RUN dnf install -y rpm-build rpmlint dnf-plugins-core COPY SPECS /root/rpmbuild/SPECS RUN dnf builddep -y /root/rpmbuild/SPECS/*.spec -COPY --from=golang /usr/local/go /usr/local/go/ -COPY --from=engine /bin/dockerd /sources/ -COPY --from=engine /bin/docker-proxy /sources/ -COPY --from=engine /bin/docker-init /sources/ +COPY --from=golang /usr/local/go /usr/local/go WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] From 09b3ac888d8d6ab625e56a458f6bd6f72b1ba0c2 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Mon, 25 Mar 2019 21:53:14 +0000 Subject: [PATCH 2/2] DEB: build the daemon as part of the package Restores previous behavior when it comes to building the daemon plus its dependencies (docker-proxy, docker-init) Signed-off-by: Eli Uriegas Signed-off-by: Eli Uriegas Signed-off-by: Eli Uriegas --- deb/Makefile | 22 ++++++++++++++++------ deb/build-deb | 11 +++++++++++ deb/common/control | 15 +++++++++++++-- deb/common/docker-ce.postinst | 24 ------------------------ deb/common/docker-ce.prerm | 6 ------ deb/common/rules | 19 +++++++++++++++---- deb/debian-buster/Dockerfile | 9 --------- deb/debian-stretch/Dockerfile | 9 --------- deb/raspbian-stretch/Dockerfile | 9 --------- deb/ubuntu-bionic/Dockerfile | 9 --------- deb/ubuntu-cosmic/Dockerfile | 9 --------- deb/ubuntu-disco/Dockerfile | 9 --------- deb/ubuntu-xenial/Dockerfile | 9 --------- 13 files changed, 55 insertions(+), 105 deletions(-) delete mode 100755 deb/common/docker-ce.prerm diff --git a/deb/Makefile b/deb/Makefile index f09572cdfe..44745e6c09 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -5,6 +5,7 @@ ARCH:=$(shell uname -m) CLI_DIR:=$(CURDIR)/../../cli GITCOMMIT?=$(shell cd $(CLI_DIR) && git rev-parse --short HEAD) VERSION?=0.0.0-dev +STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) GO_BASE_IMAGE=golang GO_VERSION:=1.11.5 GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION) @@ -21,7 +22,6 @@ BUILD?=docker build \ $(BUILD_IMAGE_FLAG) \ --build-arg GO_IMAGE=$(GO_IMAGE) \ --build-arg COMMON_FILES=$(COMMON_FILES) \ - --build-arg ENGINE_IMAGE="$(shell cat sources/engine-image)" \ -t debbuild-$@/$(ARCH) \ -f $(CURDIR)/$@/Dockerfile . # Additional flags may be necessary at some point @@ -35,7 +35,7 @@ RUN=docker run --rm -i \ $(RUN_FLAGS) \ debbuild-$@/$(ARCH) -SOURCE_FILES=engine-image cli.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz +SOURCE_FILES=engine-image cli.tgz engine.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz SOURCES=$(addprefix sources/, $(SOURCE_FILES)) .PHONY: help @@ -94,6 +94,14 @@ raspbian-stretch: $(SOURCES) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ +sources/engine.tgz: + mkdir -p $(@D) + docker run --rm -i -w /v \ + -v $(ENGINE_DIR):/engine \ + -v $(CURDIR)/$(@D):/v \ + alpine \ + tar -C / -c -z -f /v/engine.tgz --exclude .git engine + sources/cli.tgz: mkdir -p $(@D) docker run --rm -i -w /v \ @@ -110,15 +118,17 @@ sources/docker.socket: ../systemd/docker.socket mkdir -p $(@D) cp $< $@ +# TODO: Figure out how to decouple this +# TODO: These might just end up being static files that are hardcoded +# TODO: FROM HERE <===================== sources/distribution_based_engine.json: sources/engine-image mkdir -p $(@D) - docker inspect "$(shell cat $<)" \ - --format '{{index .Config.Labels "com.docker.distribution_based_engine" }}' > $@ + echo '{"platform":"Docker Engine - Community","engine_image":"engine-community","containerd_min_version":"1.2.0-beta.1","runtime":"host_install"}' > $@ sources/engine-image: mkdir -p $(@D) - $(MAKE) -C ../image image-linux - cp ../image/image-linux $@ + echo "docker.io/dockereng/engine-community:$(STATIC_VERSION)" > $@ +# TODO: TO HERE <===================== sources/plugin-installers.tgz: $(wildcard ../plugins/*) docker run --rm -i -w /v \ diff --git a/deb/build-deb b/deb/build-deb index 66f4c99b2b..f9b5fbbb73 100755 --- a/deb/build-deb +++ b/deb/build-deb @@ -2,6 +2,17 @@ set -x set -e +# untar sources +mkdir -p /root/build-deb/engine +tar -C /root/build-deb -xzf /sources/engine.tgz +mkdir -p /root/build-deb/cli +tar -C /root/build-deb -xzf /sources/cli.tgz + +# link them to their canonical path +mkdir -p /go/src/github.com/docker +ln -snf /root/build-deb/engine /go/src/github.com/docker/docker +ln -snf /root/build-deb/cli /go/src/github.com/docker/cli + EPOCH="${EPOCH:-}" EPOCH_SEP="" if [[ ! -z "$EPOCH" ]]; then diff --git a/deb/common/control b/deb/common/control index 4dbded6476..dc74dd56ed 100644 --- a/deb/common/control +++ b/deb/common/control @@ -2,13 +2,24 @@ Source: docker-ce Section: admin Priority: optional Maintainer: Docker -Build-Depends: bash-completion, +Build-Depends: bash, + bash-completion, + libbtrfs-dev | btrfs-tools, + ca-certificates, + cmake, dh-apparmor, dh-systemd, + gcc, + git, + libc-dev, + libdevmapper-dev, libltdl-dev, + libseccomp-dev, libseccomp2, + libsystemd-dev, + libtool, make, - gcc + pkg-config Standards-Version: 3.9.6 Homepage: https://www.docker.com Vcs-Browser: https://github.com/docker/docker diff --git a/deb/common/docker-ce.postinst b/deb/common/docker-ce.postinst index d25267648f..eeef6ca801 100644 --- a/deb/common/docker-ce.postinst +++ b/deb/common/docker-ce.postinst @@ -1,26 +1,6 @@ #!/bin/sh set -e -update_dockerd() { - dbefile=/var/lib/docker-engine/distribution_based_engine.json - URL=https://docs.docker.com/releasenote - if [ -f "${dbefile}" ] && sed -e 's/.*"platform"[ \t]*:[ \t]*"\([^"]*\)".*/\1/g' "${dbefile}"| grep -v -i community > /dev/null; then - echo - echo - echo - echo "Warning: Your engine has been activated to Docker Engine - Enterprise but you are still using Community packages" - echo "You can use the 'docker engine update' command to update your system, or switch to using the Enterprise packages." - echo "See $URL for more details." - echo - echo - echo - else - rm -f /usr/bin/dockerd - update-alternatives --install /usr/bin/dockerd dockerd /usr/bin/dockerd-ce 1 --slave \ - ${dbefile} distribution_based_engine.json /var/lib/docker-engine/distribution_based_engine-ce.json - fi -} - case "$1" in configure) if [ -z "$2" ]; then @@ -28,10 +8,6 @@ case "$1" in groupadd --system docker fi fi - update_dockerd - ;; - update) - update_dockerd ;; abort-*) # How'd we get here?? diff --git a/deb/common/docker-ce.prerm b/deb/common/docker-ce.prerm deleted file mode 100755 index 9109e31f7a..0000000000 --- a/deb/common/docker-ce.prerm +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -e - -#DEBHELPER# - -update-alternatives --remove dockerd /usr/bin/dockerd-ce diff --git a/deb/common/rules b/deb/common/rules index 103b2c0286..5804390247 100644 --- a/deb/common/rules +++ b/deb/common/rules @@ -1,6 +1,7 @@ #!/usr/bin/make -f VERSION ?= $(shell cat engine/VERSION) +DOCKER_GOPATH := /go/src/github.com/docker override_dh_gencontrol: # if we're on Ubuntu, we need to Recommends: apparmor @@ -8,8 +9,14 @@ override_dh_gencontrol: dh_gencontrol override_dh_auto_build: + # Build the daemon and dependencies + cd engine && PRODUCT=docker ./hack/make.sh dynbinary + cd engine && TMP_GOPATH="/go" hack/dockerfile/install/install.sh tini + cd engine && TMP_GOPATH="/go" hack/dockerfile/install/install.sh proxy dynamic + # Build the CLI cd /go/src/github.com/docker/cli && \ LDFLAGS='' DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=$(VERSION) GITCOMMIT=$(DOCKER_GITCOMMIT) dynbinary manpages + # Build the CLI plugins # Make sure to set LDFLAGS="" since, dpkg-buildflags sets it to some weird values set -e;cd /sources && \ tar xzf plugin-installers.tgz; \ @@ -17,6 +24,10 @@ override_dh_auto_build: LDFLAGS='' bash $${installer} build; \ done +override_dh_auto_test: + ./engine/bundles/dynbinary-daemon/dockerd -v + ./cli/build/docker -v + override_dh_strip: # Go has lots of problems with stripping, so just don't @@ -35,10 +46,10 @@ override_dh_auto_install: # docker-ce install install -D -m 0644 /sources/docker.service debian/docker-ce/lib/systemd/system/docker.service install -D -m 0644 /sources/docker.socket debian/docker-ce/lib/systemd/system/docker.socket - install -D -m 0755 /source/dockerd debian/docker-ce/usr/bin/dockerd-ce - install -D -m 0755 /source/docker-proxy debian/docker-ce/usr/bin/docker-proxy - install -D -m 0755 /source/docker-init debian/docker-ce/usr/bin/docker-init - install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker-engine/distribution_based_engine-ce.json + install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/dockerd) debian/docker-ce/usr/bin/dockerd + install -D -m 0755 /usr/local/bin/docker-proxy debian/docker-ce/usr/bin/docker-proxy + install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init + install -D -m 0644 /sources/distribution_based_engine.json debian/docker-ce/var/lib/docker-engine/distribution_based_engine.json override_dh_installinit: # use "docker" as our service name, not "docker-ce" diff --git a/deb/debian-buster/Dockerfile b/deb/debian-buster/Dockerfile index add29f72b2..ee4f859659 100644 --- a/deb/debian-buster/Dockerfile +++ b/deb/debian-buster/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE ARG BUILD_IMAGE=debian:buster -ARG ENGINE_IMAGE FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO debian ENV SUITE buster COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/debian-stretch/Dockerfile b/deb/debian-stretch/Dockerfile index 003f26a4ba..0d89b4e8c8 100644 --- a/deb/debian-stretch/Dockerfile +++ b/deb/debian-stretch/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=debian:stretch FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO debian ENV SUITE stretch COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/raspbian-stretch/Dockerfile b/deb/raspbian-stretch/Dockerfile index 83bab8c651..74ecfac187 100644 --- a/deb/raspbian-stretch/Dockerfile +++ b/deb/raspbian-stretch/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=resin/rpi-raspbian:stretch FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO raspbian ENV SUITE stretch COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/ubuntu-bionic/Dockerfile b/deb/ubuntu-bionic/Dockerfile index 6ee9eae18f..ff7b8ae733 100644 --- a/deb/ubuntu-bionic/Dockerfile +++ b/deb/ubuntu-bionic/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=ubuntu:bionic FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO ubuntu ENV SUITE bionic COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/ubuntu-cosmic/Dockerfile b/deb/ubuntu-cosmic/Dockerfile index 9b6d078676..4a13589510 100644 --- a/deb/ubuntu-cosmic/Dockerfile +++ b/deb/ubuntu-cosmic/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=ubuntu:cosmic FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO ubuntu ENV SUITE cosmic COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/ubuntu-disco/Dockerfile b/deb/ubuntu-disco/Dockerfile index 8f124e4089..f640c97630 100644 --- a/deb/ubuntu-disco/Dockerfile +++ b/deb/ubuntu-disco/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=ubuntu:disco FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO ubuntu ENV SUITE disco COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb diff --git a/deb/ubuntu-xenial/Dockerfile b/deb/ubuntu-xenial/Dockerfile index 68ef9ff942..28eb242285 100644 --- a/deb/ubuntu-xenial/Dockerfile +++ b/deb/ubuntu-xenial/Dockerfile @@ -1,8 +1,6 @@ ARG GO_IMAGE -ARG ENGINE_IMAGE ARG BUILD_IMAGE=ubuntu:xenial FROM ${GO_IMAGE} as golang -FROM ${ENGINE_IMAGE} as engine FROM ${BUILD_IMAGE} @@ -18,19 +16,12 @@ 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 COPY sources/ /sources -RUN mkdir -p /go/src/github.com/docker/ && tar -xzf /sources/cli.tgz -C /go/src/github.com/docker/ - -RUN ln -snf /go/src/github.com/docker/cli /root/build-deb/cli ENV DISTRO ubuntu ENV SUITE xenial COPY --from=golang /usr/local/go /usr/local/go -COPY --from=engine /bin/dockerd /source/ -COPY --from=engine /bin/docker-proxy /source/ -COPY --from=engine /bin/docker-init /source/ WORKDIR /root/build-deb COPY build-deb /root/build-deb/build-deb