diff --git a/.gitignore b/.gitignore index c0df4cbe94..91761704c8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ tmp artifacts sources *.tar -image-linux* diff --git a/Jenkinsfile b/Jenkinsfile index 45daa90e12..8394ff01c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,72 +1,56 @@ #!groovy - -def genBranch(String arch) { - return [ - "${arch}": { -> - stage("Build engine image on ${arch}") { - wrappedNode(label: "linux&&${arch}", cleanWorkspace: true) { - try { - checkout scm - sh("git clone https://github.com/docker/engine.git engine") - sh('make ENGINE_DIR=$(pwd)/engine image') - } finally { - sh('make ENGINE_DIR=$(pwd)/engine clean-image clean-engine') - } - } - } - }] -} - def branch = env.CHANGE_TARGET ?: env.BRANCH_NAME test_steps = [ 'deb': { -> stage('Ubuntu Xenial Debian Package') { wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) { - checkout scm - sh('git clone https://github.com/docker/cli.git') - sh("git -C cli checkout $branch") - sh('git clone https://github.com/docker/engine.git') - sh("git -C engine checkout $branch") - sh('make -C deb VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli ubuntu-xenial') + try { + checkout scm + sh('git clone https://github.com/docker/cli.git') + sh("git -C cli checkout $branch") + sh('git clone https://github.com/docker/engine.git') + sh("git -C engine checkout $branch") + sh('make -C deb VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli ubuntu-xenial') + } finally { + sh('make ENGINE_DIR=$(pwd)/engine clean-engine') + } } } }, 'rpm': { -> stage('Centos 7 RPM Package') { wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) { - checkout scm - sh('git clone https://github.com/docker/cli.git') - sh("git -C cli checkout $branch") - sh('git clone https://github.com/docker/engine.git') - sh("git -C engine checkout $branch") - sh('make -C rpm VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli centos-7') + try { + checkout scm + sh('git clone https://github.com/docker/cli.git') + sh("git -C cli checkout $branch") + sh('git clone https://github.com/docker/engine.git') + sh("git -C engine checkout $branch") + sh('make -C rpm VERSION=0.0.1-dev ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli centos-7') + } finally { + sh('make ENGINE_DIR=$(pwd)/engine clean-engine') + } } } }, 'static': { -> stage('Static Linux Binaries') { wrappedNode(label: 'ubuntu && x86_64', cleanWorkspace: true) { - checkout scm - sh('git clone https://github.com/docker/cli.git') - sh("git -C cli checkout $branch") - sh('git clone https://github.com/docker/engine.git') - sh("git -C engine checkout $branch") - sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=static-linux ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli static') + try { + checkout scm + sh('git clone https://github.com/docker/cli.git') + sh("git -C cli checkout $branch") + sh('git clone https://github.com/docker/engine.git') + sh("git -C engine checkout $branch") + sh('make VERSION=0.0.1-dev DOCKER_BUILD_PKGS=static-linux ENGINE_DIR=$(pwd)/engine CLI_DIR=$(pwd)/cli static') + } finally { + sh('make ENGINE_DIR=$(pwd)/engine clean-engine') + } } } }, ] -arches = [ - "x86_64", - "aarch64", - "armhf" -] - -arches.each { - test_steps << genBranch(it) -} - parallel(test_steps) diff --git a/Makefile b/Makefile index 394586831e..6f54293594 100644 --- a/Makefile +++ b/Makefile @@ -15,13 +15,8 @@ help: ## show make targets clean-engine: rm -rf $(ENGINE_DIR) -.PHONY: clean-image -clean-image: - $(MAKE) ENGINE_DIR=$(ENGINE_DIR) -C image clean - - .PHONY: clean -clean: clean-image ## remove build artifacts +clean: ## remove build artifacts $(MAKE) -C rpm clean $(MAKE) -C deb clean $(MAKE) -C static clean @@ -40,18 +35,3 @@ static: ## build static-compiled packages for p in $(DOCKER_BUILD_PKGS); do \ $(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \ done - -# TODO - figure out multi-arch -.PHONY: image -image: DOCKER_BUILD_PKGS:=image-linux -image: ## build static-compiled packages - for p in $(DOCKER_BUILD_PKGS); do \ - $(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \ - done - -engine-$(ARCH).tar: - $(MAKE) -C image $@ - -.PHONY: release -release: - $(MAKE) -C image $@ diff --git a/deb/Makefile b/deb/Makefile index 2c631ac1c6..838f394c01 100644 --- a/deb/Makefile +++ b/deb/Makefile @@ -34,7 +34,7 @@ RUN=docker run --rm -i \ $(RUN_FLAGS) \ debbuild-$@/$(ARCH) -SOURCE_FILES=engine-image cli.tgz engine.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz +SOURCE_FILES=engine-image cli.tgz engine.tgz docker.service docker.socket plugin-installers.tgz SOURCES=$(addprefix sources/, $(SOURCE_FILES)) DEBIAN_VERSIONS := debian-stretch debian-buster diff --git a/deb/common/rules b/deb/common/rules index 5804390247..57035dba7d 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -49,7 +49,6 @@ override_dh_auto_install: 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/image/Dockerfile.engine b/image/Dockerfile.engine deleted file mode 100644 index d842ec5cbf..0000000000 --- a/image/Dockerfile.engine +++ /dev/null @@ -1,101 +0,0 @@ -# Common builder -ARG GO_IMAGE -FROM ${GO_IMAGE} as builder - -COPY hack/dockerfile/install/tini.installer / -COPY hack/dockerfile/install/proxy.installer / -RUN apt-get update && apt-get install -y \ - bash \ - btrfs-tools \ - ca-certificates \ - cmake \ - gcc \ - git \ - libc-dev \ - libgcc-6-dev \ - libltdl-dev \ - libseccomp-dev \ - libtool \ - make -RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits - -# dockerd -FROM builder as dockerd-builder -RUN apt-get install -y \ - libsystemd-dev -WORKDIR /go/src/github.com/docker/docker -COPY . /go/src/github.com/docker/docker -ARG VERSION -ARG GITCOMMIT -ARG BUILDTIME -ARG PLATFORM -ARG PRODUCT -ARG DEFAULT_PRODUCT_LICENSE -ENV VERSION ${VERSION} -ENV GITCOMMIT ${GITCOMMIT} -ENV BUILDTIME ${BUILDTIME} -ENV PLATFORM ${PLATFORM} -ENV PRODUCT ${PRODUCT} -ENV DEFAULT_PRODUCT_LICENSE ${DEFAULT_PRODUCT_LICENSE} -# TODO The way we set the version could easily be simplified not to depend on hack/... -RUN bash ./hack/make/.go-autogen -RUN go build -o /sbin/dockerd \ - -tags 'autogen apparmor seccomp selinux journald exclude_graphdriver_devicemapper' \ - -i \ - -buildmode=pie \ - -a -ldflags '-w'\ - github.com/docker/docker/cmd/dockerd - -# docker-proxy -# TODO if libnetwork folds into the docker tree this can be combined above -FROM builder as proxy-builder -RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker/libnetwork -WORKDIR /go/src/github.com/docker/libnetwork -RUN . /binaries-commits && \ - git checkout -q "$LIBNETWORK_COMMIT" && \ - CGO_ENABLED=0 go build -buildmode=pie -ldflags="$PROXY_LDFLAGS" \ - -o /sbin/docker-proxy \ - github.com/docker/libnetwork/cmd/proxy - -# docker-init - TODO move this out, last time we bumped was 2016! -FROM builder as init-builder -RUN git clone https://github.com/krallin/tini.git /tini -WORKDIR /tini -RUN . /binaries-commits && \ - git checkout -q "$TINI_COMMIT" && \ - cmake . && make tini-static && \ - cp tini-static /sbin/docker-init - -# runc -FROM builder as runc-builder -RUN apt-get install -y libseccomp-dev -RUN git clone https://github.com/opencontainers/runc.git /go/src/github.com/opencontainers/runc -WORKDIR /go/src/github.com/opencontainers/runc -RUN . /binaries-commits && \ - git checkout -q "$RUNC_COMMIT" && \ - make BUILDTAGS='seccomp apparmor' static && make install - -# Final docker image -FROM scratch -ARG VERSION -ARG GITCOMMIT -ARG BUILDTIME -ARG PLATFORM -ARG ENGINE_IMAGE -COPY --from=dockerd-builder /sbin/dockerd /bin/ -COPY --from=proxy-builder /sbin/docker-proxy /bin/ -COPY --from=init-builder /sbin/docker-init /bin/ -COPY --from=runc-builder /usr/local/sbin/runc /bin/ - -LABEL \ - org.opencontainers.image.authors="Docker Inc." \ - org.opencontainers.image.created="${BUILDTIME}" \ - org.opencontainers.image.documentation="https://docs.docker.com/" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.revision="${GITCOMMIT}" \ - org.opencontainers.image.url="https://www.docker.com/products/docker-engine" \ - org.opencontainers.image.vendor="Docker Inc." \ - org.opencontainers.image.version="${VERSION}" \ - com.docker.distribution_based_engine="{\"platform\":\"${PLATFORM}\",\"engine_image\":\"${ENGINE_IMAGE}\",\"containerd_min_version\":\"1.2.0-beta.1\",\"runtime\":\"host_install\"}" - -ENTRYPOINT ["/bin/dockerd"] diff --git a/image/Dockerfile.engine-dm b/image/Dockerfile.engine-dm deleted file mode 100644 index d7379a8022..0000000000 --- a/image/Dockerfile.engine-dm +++ /dev/null @@ -1,97 +0,0 @@ -# Common builder -ARG GO_IMAGE -ARG BASE_IMAGE=centos:7 -FROM ${GO_IMAGE} as golang - -FROM ${BASE_IMAGE} as builder -ENV GOPATH=/go -ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin -ENV AUTO_GOPATH 1 -COPY --from=golang /usr/local/go /usr/local/go -COPY hack/dockerfile/install/tini.installer / -COPY hack/dockerfile/install/proxy.installer / -RUN yum install -y \ - bash \ - ca-certificates \ - cmake \ - gcc \ - git \ - glibc-static \ - libtool \ - make -RUN grep "_COMMIT=" /*.installer |cut -f2- -d: > /binaries-commits - -# dockerd -FROM builder as dockerd-builder -RUN yum install -y \ - btrfs-progs-devel \ - device-mapper-devel \ - libseccomp-devel \ - selinux-policy-devel \ - systemd-devel -WORKDIR /go/src/github.com/docker/docker -COPY . /go/src/github.com/docker/docker -ARG VERSION -ARG GITCOMMIT -ARG BUILDTIME -ARG PLATFORM -ARG PRODUCT -ARG DEFAULT_PRODUCT_LICENSE -ENV VERSION ${VERSION} -ENV GITCOMMIT ${GITCOMMIT} -ENV BUILDTIME ${BUILDTIME} -ENV PLATFORM ${PLATFORM} -ENV PRODUCT ${PRODUCT} -ENV DEFAULT_PRODUCT_LICENSE ${DEFAULT_PRODUCT_LICENSE} -# TODO The way we set the version could easily be simplified not to depend on hack/... -RUN bash ./hack/make/.go-autogen -RUN go build -o /dockerd \ - -tags 'autogen apparmor seccomp selinux journald' \ - -i \ - -buildmode=pie \ - -a -ldflags '-w'\ - github.com/docker/docker/cmd/dockerd - -# docker-proxy -# TODO if libnetwork folds into the docker tree this can be combined above -FROM builder as proxy-builder -RUN git clone https://github.com/docker/libnetwork.git /go/src/github.com/docker/libnetwork -WORKDIR /go/src/github.com/docker/libnetwork -RUN . /binaries-commits && \ - git checkout -q "$LIBNETWORK_COMMIT" && \ - go build -buildmode=pie -ldflags="-w" \ - -o /docker-proxy \ - github.com/docker/libnetwork/cmd/proxy - -# docker-init - TODO move this out, last time we bumped was 2016! -FROM builder as init-builder -RUN git clone https://github.com/krallin/tini.git /tini -WORKDIR /tini -RUN . /binaries-commits && \ - git checkout -q "$TINI_COMMIT" && \ - cmake . && make tini-static && \ - cp tini-static /docker-init - -# Final docker image -FROM scratch -ARG VERSION -ARG GITCOMMIT -ARG BUILDTIME -ARG PLATFORM -ARG ENGINE_IMAGE -COPY --from=dockerd-builder /dockerd /bin/ -COPY --from=proxy-builder /docker-proxy /bin/ -COPY --from=init-builder /docker-init /bin/ - -LABEL \ - org.opencontainers.image.authors="Docker Inc." \ - org.opencontainers.image.created="${BUILDTIME}" \ - org.opencontainers.image.documentation="https://docs.docker.com/" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.revision="${GITCOMMIT}" \ - org.opencontainers.image.url="https://www.docker.com/products/docker-engine" \ - org.opencontainers.image.vendor="Docker Inc." \ - org.opencontainers.image.version="${VERSION}" \ - com.docker.distribution_based_engine="{\"platform\":\"${PLATFORM}\",\"engine_image\":\"${ENGINE_IMAGE}\",\"containerd_min_version\":\"1.2.0-beta.1\",\"runtime\":\"host_install\"}" - -ENTRYPOINT ["/bin/dockerd"] diff --git a/image/Makefile b/image/Makefile deleted file mode 100644 index 65142ead94..0000000000 --- a/image/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -include ../common.mk - -CLI_DIR:=$(realpath $(CURDIR)/../../cli) -ENGINE_DIR:=$(realpath $(CURDIR)/../../engine) -GO_BASE_IMAGE=golang -ENGINE_GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)-stretch -STATIC_VERSION:=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) -DOCKER_HUB_ORG?=dockereng -ENGINE_IMAGE?=engine-community -CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown -IMAGE_WITH_TAG=$(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION) -ifdef BASE_IMAGE - # TODO: Clean this up to only set ENGINE_GO_IMAGE - BASE_IMAGE_FLAG=--build-arg BASE_IMAGE=$(BASE_IMAGE) - ENGINE_GO_IMAGE=$(BASE_IMAGE) -endif -IMAGE_BUILD?=docker build -t $(IMAGE_WITH_TAG) \ - --build-arg GO_IMAGE="$(ENGINE_GO_IMAGE)" \ - --build-arg VERSION="$(STATIC_VERSION)" \ - --build-arg GITCOMMIT="$$(cd $(ENGINE_DIR) && git rev-parse --short=7 HEAD)" \ - --build-arg BUILDTIME="$(BUILDTIME)" \ - --build-arg PLATFORM="$(PLATFORM)" \ - --build-arg PRODUCT="$(PRODUCT)" \ - --build-arg ENGINE_IMAGE="$(ENGINE_IMAGE)" \ - --build-arg DEFAULT_PRODUCT_LICENSE="$(DEFAULT_PRODUCT_LICENSE)" \ - $(BASE_IMAGE_FLAG) \ - --file $< $(ENGINE_DIR) - -.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) - -.PHONY: clean -clean: ## remove build artifacts - -$(RM) $(ENGINE_DIR)/Dockerfile.engine - -$(RM) $(ENGINE_DIR)/Dockerfile.engine-dm - -docker rmi $(IMAGE_WITH_TAG) - -docker rmi $(IMAGE_WITH_TAG)-dm - -rm -f image-linux - -$(RM) -r artifacts - -$(RM) *.tar - -.PHONY: image -image: image-linux - -$(ENGINE_DIR)/Dockerfile.%: Dockerfile.% - cp $< $@ - -DOCKER2OCI=artifacts/docker2oci -$(DOCKER2OCI): - -$(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - 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 - $(CHOWN) -R $(shell id -u):$(shell id -g) $(@D) - -# builds across multiple archs because the base images -# utilize manifests -image-linux: $(ENGINE_DIR)/Dockerfile.engine - $(IMAGE_BUILD) - echo $(IMAGE_WITH_TAG) > $@ - -engine-$(ARCH).tar: engine-$(ARCH)-docker-compat.tar $(DOCKER2OCI) - mkdir -p artifacts - ./$(DOCKER2OCI) -i $< artifacts/engine-image - mkdir -p $(@D) - tar c -C artifacts/engine-image . > $@ - -engine-$(ARCH)-docker-compat.tar: image-linux - docker save -o $@ $$(cat $<) - -image-linux-dm: ENGINE_IMAGE:=$(ENGINE_IMAGE)-dm -image-linux-dm: $(ENGINE_DIR)/Dockerfile.engine-dm - $(IMAGE_BUILD) - echo $(IMAGE_WITH_TAG) > $@ - -engine-$(ARCH)-dm.tar: engine-$(ARCH)-dm-docker-compat.tar $(DOCKER2OCI) - mkdir -p artifacts - ./$(DOCKER2OCI) -i $< artifacts/engine-image - mkdir -p $(@D) - tar c -C artifacts/engine-image . > $@ - -engine-$(ARCH)-dm-docker-compat.tar: image-linux-dm - docker save -o $@ $$(cat $<) diff --git a/rpm/Makefile b/rpm/Makefile index a876e18a0e..40c4680855 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -39,7 +39,7 @@ RPMBUILD_FLAGS?=-ba\ $(SPECS) RUN?=$(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) -SOURCE_FILES=engine-image engine.tgz 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 plugin-installers.tgz SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_FILES)) FEDORA_RELEASES := fedora-31 fedora-30 fedora-29 diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index 83e8ec767f..f37ccb78d4 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -103,16 +103,12 @@ install -D -p -m 755 /usr/local/bin/docker-init $RPM_BUILD_ROOT/%{_bindir}/docke 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.json - %files /%{_bindir}/dockerd /%{_bindir}/docker-proxy /%{_bindir}/docker-init /%{_unitdir}/docker.service /%{_unitdir}/docker.socket -/var/lib/docker-engine/distribution_based_engine.json %post %systemd_post docker.service