diff --git a/components/packaging/.gitignore b/components/packaging/.gitignore index b17df620f3..c0f77a4b3d 100644 --- a/components/packaging/.gitignore +++ b/components/packaging/.gitignore @@ -1,3 +1,5 @@ build debbuild rpmbuild +tmp +artifacts diff --git a/components/packaging/common/dockerd.json b/components/packaging/common/dockerd.json new file mode 100644 index 0000000000..d09197cafa --- /dev/null +++ b/components/packaging/common/dockerd.json @@ -0,0 +1,11 @@ +{ + "image": "docker.io/seemethere/engine-community:0.0.0-20180814124044-678d4b3a6d.x86_64", + "namespace":"docker", + "args": [ + "-s", "overlay", + "--containerd", "/run/containerd/containerd.sock", + "--default-runtime", "containerd", + "--add-runtime", "containerd=runc" + ], + "scope": "ce" +} diff --git a/components/packaging/containerd.mk b/components/packaging/containerd.mk new file mode 100644 index 0000000000..12bad420f7 --- /dev/null +++ b/components/packaging/containerd.mk @@ -0,0 +1,17 @@ +# Common things for containerd functionality + +CONTAINERD_PROXY_COMMIT=82ae3d13e91d062dd4853379fe018638023c8da2 +CONTAINERD_SHIM_PROCESS_IMAGE=docker.io/docker/containerd-shim-process:ff98a47 + +# If containerd is running use that socket instead +ifeq ($(shell systemctl status containerd 2>/dev/null >/dev/null && echo -n "yes"), "yes") +CONTAINERD_SOCK:=/var/run/containerd/containerd.sock +else +CONTAINERD_SOCK:=/var/run/docker/containerd/docker-containerd.sock +endif +CTR=docker run \ + --rm -i \ + -v $(CONTAINERD_SOCK):/ours/containerd.sock \ + -v $(CURDIR)/artifacts:/artifacts \ + docker:18.06.0-ce \ + docker-containerd-ctr -a /ours/containerd.sock diff --git a/components/packaging/deb/Makefile b/components/packaging/deb/Makefile index 70402d9802..0e35082c01 100644 --- a/components/packaging/deb/Makefile +++ b/components/packaging/deb/Makefile @@ -45,49 +45,49 @@ debian: debian-stretch debian-jessie ## build all debian deb packages raspbian: raspbian-stretch debian-jessie ## build all raspbian deb packages .PHONY: ubuntu-xenial -ubuntu-xenial: engine-$(ARCH).tar ## build ubuntu xenial deb packages +ubuntu-xenial: ## build ubuntu xenial deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: ubuntu-trusty -ubuntu-trusty: engine-$(ARCH).tar ## build ubuntu trusty deb packages +ubuntu-trusty: ## build ubuntu trusty deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: ubuntu-bionic -ubuntu-bionic: engine-$(ARCH).tar ## build ubuntu bionic deb packages +ubuntu-bionic: ## build ubuntu bionic deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-buster -debian-buster: engine-$(ARCH).tar ## build debian buster deb packages +debian-buster: ## build debian buster deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-jessie -debian-jessie: engine-$(ARCH).tar ## build debian jessie deb packages +debian-jessie: ## build debian jessie deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: debian-stretch -debian-stretch: engine-$(ARCH).tar ## build debian stretch deb packages +debian-stretch: ## build debian stretch deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: raspbian-jessie -raspbian-jessie: engine-$(ARCH).tar ## build raspbian jessie deb packages +raspbian-jessie: ## build raspbian jessie deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ .PHONY: raspbian-stretch -raspbian-stretch: engine-$(ARCH).tar ## build raspbian stretch deb packages +raspbian-stretch: ## build raspbian stretch deb packages $(BUILD) $(RUN) $(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@ diff --git a/components/packaging/image/Makefile b/components/packaging/image/Makefile index 180ee81b82..49fb98721a 100644 --- a/components/packaging/image/Makefile +++ b/components/packaging/image/Makefile @@ -3,7 +3,7 @@ ENGINE_DIR:=$(CURDIR)/../../engine CLI_DIR:=$(CURDIR)/../../cli VERSION?=0.0.0-dev STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION)) -DOCKER_HUB_ORG?=docker +DOCKER_HUB_ORG?=dockereng ARCH=$(shell uname -m) ENGINE_IMAGE?=engine-community diff --git a/components/packaging/rpm/Makefile b/components/packaging/rpm/Makefile index fa2cb74c09..a090795dd4 100644 --- a/components/packaging/rpm/Makefile +++ b/components/packaging/rpm/Makefile @@ -1,24 +1,28 @@ +include ../containerd.mk + ARCH=$(shell uname -m) ENGINE_DIR:=$(CURDIR)/../../engine CLI_DIR:=$(CURDIR)/../../cli GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD) VERSION?=0.0.0-dev +GO_BASE_IMAGE=golang GO_VERSION:=1.10.3 -GEN_RPM_VER=$(shell ./gen-rpm-ver $(ENGINE_DIR) $(VERSION)) +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 RPMBUILD=docker run --privileged --rm -i\ -v $(CURDIR)/rpmbuild/SOURCES:/root/rpmbuild/SOURCES \ - -v $(CURDIR)/rpmbuild/BUILD:/root/rpmbuild/BUILD \ - -v $(CURDIR)/rpmbuild/BUILDROOT:/root/rpmbuild/BUILDROOT \ -v $(CURDIR)/rpmbuild/RPMS:/root/rpmbuild/RPMS \ - -v $(CURDIR)/rpmbuild/SRPMS:/root/rpmbuild/SRPMS \ - -v $(CURDIR)/systemd:/systemd + -v $(CURDIR)/rpmbuild/SRPMS:/root/rpmbuild/SRPMS RPMBUILD_FLAGS=-ba\ --define '_gitcommit $(word 3,$(GEN_RPM_VER))' \ --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.spec SPECS/docker-ce-cli.spec + +SOURCE_FILES=containerd-proxy.tgz cli.tgz containerd-shim-process.tar docker.service dockerd.json +SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_FILES)) .PHONY: help help: ## show make targets @@ -27,7 +31,11 @@ help: ## show make targets .PHONY: clean clean: ## remove build artifacts [ ! -d rpmbuild ] || $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild - rm -rf rpmbuild + $(RM) -r rpmbuild/ + [ ! -d artifacts ] || $(CHOWN) -R $(shell id -u):$(shell id -g) artifacts + $(RM) -r artifacts/ + [ ! -d tmp ] || $(CHOWN) -R $(shell id -u):$(shell id -g) tmp + $(RM) -r tmp/ .PHONY: rpm rpm: fedora centos ## build all rpm packages @@ -38,25 +46,27 @@ fedora: fedora-28 fedora-27 fedora-26 ## build all fedora rpm packages .PHONY: centos centos: centos-7 ## build all centos rpm packages -engine-$(ARCH).tar: - $(MAKE) -C ../image image-linux - docker save -o $@ $$(cat ../image/image-linux) - .PHONY: fedora-28 -fedora-28: engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-28 rpm packages - docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ +fedora-28: ## build fedora-28 rpm packages +fedora-28: $(SOURCES) + $(CHOWN) -R root:root rpmbuild + docker build --build-arg GO_IMAGE=$(GO_IMAGE) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) . $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild .PHONY: fedora-27 -fedora-27:engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build fedora-27 rpm packages - docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ +fedora-27: ## build fedora-27 rpm packages +fedora-27: $(SOURCES) + $(CHOWN) -R root:root rpmbuild + docker build --build-arg GO_IMAGE=$(GO_IMAGE) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) . $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild .PHONY: centos-7 -centos-7:engine-$(ARCH).tar rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz ## build centos-7 rpm packages - docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) $@ +centos-7: ## build centos-7 rpm packages +centos-7: $(SOURCES) + $(CHOWN) -R root:root rpmbuild + docker build --build-arg GO_IMAGE=$(GO_IMAGE) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) . $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild @@ -68,10 +78,29 @@ rpmbuild/SOURCES/cli.tgz: alpine \ tar -C / -c -z -f /v/cli.tgz --exclude .git cli -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/containerd-proxy.tgz: + mkdir -p tmp/ + curl -fL -o tmp/containerd-proxy.tgz "https://github.com/crosbymichael/containerd-proxy/archive/$(CONTAINERD_PROXY_COMMIT)/ours.tar.gz" + tar xzf tmp/containerd-proxy.tgz -C tmp/ + mv tmp/containerd-proxy-$(CONTAINERD_PROXY_COMMIT) tmp/containerd-proxy + mkdir -p $(@D) + $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild + tar -zcf $@ -C tmp/ containerd-proxy + rm -rf tmp/ + +rpmbuild/SOURCES/containerd-shim-process.tar: + $(CTR) content fetch $(CONTAINERD_SHIM_PROCESS_IMAGE) + $(CTR) image export artifacts/containerd-shim-process.tar $(CONTAINERD_SHIM_PROCESS_IMAGE) + mkdir -p $(@D) + cp artifacts/containerd-shim-process.tar $@ + $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild + +rpmbuild/SOURCES/docker.service: ../systemd/docker.service + mkdir -p $(@D) + cp $< $@ + +rpmbuild/SOURCES/dockerd.json: ../common/dockerd.json + mkdir -p $(@D) + cp $< $@ + +# TODO: Figure out a sufficient offline solution diff --git a/components/packaging/rpm/SPECS/docker-ce-cli.spec b/components/packaging/rpm/SPECS/docker-ce-cli.spec new file mode 100644 index 0000000000..0dea3d3ed2 --- /dev/null +++ b/components/packaging/rpm/SPECS/docker-ce-cli.spec @@ -0,0 +1,103 @@ +%global debug_package %{nil} + +Name: docker-ce-cli +Version: %{_version} +Release: %{_release}%{?dist} +Epoch: 0 +Summary: The open-source application container engine +Group: Tools/Docker +License: ASL 2.0 +Source0: cli.tgz +URL: https://www.docker.com +Vendor: Docker +Packager: Docker + +# required packages on install +Requires: /bin/sh +Requires: containerd + +BuildRequires: make +BuildRequires: libtool-ltdl-devel + +# conflicting packages +Conflicts: docker +Conflicts: docker-io +Conflicts: docker-engine-cs +Conflicts: docker-ee +Conflicts: docker-ee-cli + +# Obsolete packages +Obsoletes: docker-ce-selinux +Obsoletes: docker-engine-selinux +Obsoletes: docker-engine + +%description +Docker is an open source project to build, ship and run any application as a +lightweight container. + +Docker containers are both hardware-agnostic and platform-agnostic. This means +they can run anywhere, from your laptop to the largest EC2 compute instance and +everything in between - and they don't require you to use a particular +language, framework or packaging system. That makes them great building blocks +for deploying and scaling web apps, databases, and backend services without +depending on a particular stack or provider. + +%prep +%setup -q -c -n src + +%build +mkdir -p /go/src/github.com/docker +rm -f /go/src/github.com/docker/cli +ln -s /root/rpmbuild/BUILD/src/cli /go/src/github.com/docker/cli +pushd /go/src/github.com/docker/cli +DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION=%{_origversion} GITCOMMIT=%{_gitcommit} dynbinary manpages # cli +popd + +# %check +# cli/build/docker -v + +%install +# install binary +install -d $RPM_BUILD_ROOT/%{_bindir} +install -p -m 755 cli/build/docker $RPM_BUILD_ROOT/%{_bindir}/docker + +# add bash, zsh, and fish completions +install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions +install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions +install -d $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d +install -p -m 644 cli/contrib/completion/bash/docker $RPM_BUILD_ROOT/usr/share/bash-completion/completions/docker +install -p -m 644 cli/contrib/completion/zsh/_docker $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions/_docker +install -p -m 644 cli/contrib/completion/fish/docker.fish $RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d/docker.fish + +# install manpages +install -d %{buildroot}%{_mandir}/man1 +install -p -m 644 cli/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1 +install -d %{buildroot}%{_mandir}/man5 +install -p -m 644 cli/man/man5/*.5 $RPM_BUILD_ROOT/%{_mandir}/man5 +install -d %{buildroot}%{_mandir}/man8 +install -p -m 644 cli/man/man8/*.8 $RPM_BUILD_ROOT/%{_mandir}/man8 + +mkdir -p build-docs +for cli_file in LICENSE MAINTAINERS NOTICE README.md; do + cp "cli/$cli_file" "build-docs/$cli_file" +done + +# list files owned by the package here +%files +%doc build-docs/LICENSE build-docs/MAINTAINERS build-docs/NOTICE build-docs/README.md +/%{_bindir}/docker +/usr/share/bash-completion/completions/docker +/usr/share/zsh/vendor-completions/_docker +/usr/share/fish/vendor_completions.d/docker.fish +%doc +/%{_mandir}/man1/* +/%{_mandir}/man5/* +/%{_mandir}/man8/* + + +%post +if ! getent group docker > /dev/null; then + groupadd --system docker +fi + +%changelog diff --git a/components/packaging/rpm/SPECS/docker-ce.spec b/components/packaging/rpm/SPECS/docker-ce.spec new file mode 100644 index 0000000000..77cda6a7f2 --- /dev/null +++ b/components/packaging/rpm/SPECS/docker-ce.spec @@ -0,0 +1,112 @@ +%global debug_package %{nil} + +Name: docker-ce +Version: %{_version} +Release: %{_release}%{?dist} +Epoch: 2 +Source0: containerd-proxy.tgz +Source1: containerd-shim-process.tar +Source2: docker.service +Summary: The open-source application container engine +Group: Tools/Docker +License: ASL 2.0 +URL: https://www.docker.com +Vendor: Docker +Packager: Docker + +Requires: docker-ce-cli +Requires: systemd-units +Requires: iptables +# Should be required as well by docker-ce-cli but let's just be thorough +Requires: containerd.io + +BuildRequires: which +BuildRequires: make +BuildRequires: gcc +BuildRequires: pkgconfig(systemd) + +# conflicting packages +Conflicts: docker +Conflicts: docker-io +Conflicts: docker-engine-cs +Conflicts: docker-ee + +# Obsolete packages +Obsoletes: docker-ce-selinux +Obsoletes: docker-engine-selinux +Obsoletes: docker-engine + +%description +Docker is an open source project to build, ship and run any application as a +lightweight container. + +Docker containers are both hardware-agnostic and platform-agnostic. This means +they can run anywhere, from your laptop to the largest EC2 compute instance and +everything in between - and they don't require you to use a particular +language, framework or packaging system. That makes them great building blocks +for deploying and scaling web apps, databases, and backend services without +depending on a particular stack or provider. + +%prep +%setup -q -c -n src + +%build +# dockerd proxy compilation +mkdir -p /go/src/github.com/crosbymichael/ +ls %{_topdir}/BUILD/src +ln -s %{_topdir}/BUILD/src/containerd-proxy /go/src/github.com/crosbymichael/containerd-proxy +pushd /go/src/github.com/crosbymichael/containerd-proxy +make SCOPE_LABEL="com.docker/containerd-proxy.scope" ANY_SCOPE="ee" bin/containerd-proxy +popd + +%install +# Install containerd-proxy as dockerd +install -D -m 0755 %{_topdir}/BUILD/src/containerd-proxy/bin/containerd-proxy $RPM_BUILD_ROOT/%{_bindir}/dockerd +install -D -m 0644 %{_topdir}/SOURCES/containerd-shim-process.tar $RPM_BUILD_ROOT/%{_sharedstatedir}/containerd-offline-installer/containerd-shim-process.tar +install -D -m 0644 %{_topdir}/SOURCES/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service +install -D -m 0644 %{_topdir}/SOURCES/dockerd.json $RPM_BUILD_ROOT/etc/containerd-proxy/dockerd.json + +%files +/%{_bindir}/dockerd +/%{_sharedstatedir}/containerd-offline-installer/containerd-shim-process.tar +/%{_unitdir}/docker.service +/etc/containerd-proxy/dockerd.json + +%pre +if [ $1 -gt 0 ] ; then + # package upgrade scenario, before new files are installed + + # clear any old state + rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + + # check if docker service is running + if systemctl is-active docker > /dev/null 2>&1; then + systemctl stop docker > /dev/null 2>&1 || : + touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + fi +fi + +%post +%systemd_post docker +if ! getent group docker > /dev/null; then + groupadd --system docker +fi + +%preun +%systemd_preun docker + +%postun +%systemd_postun_with_restart docker + +%posttrans +if [ $1 -ge 0 ] ; then + # package upgrade scenario, after new files are installed + + # check if docker was running before upgrade + if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then + systemctl start docker > /dev/null 2>&1 || : + rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || : + fi +fi + +%changelog diff --git a/components/packaging/rpm/centos-7/Dockerfile.aarch64 b/components/packaging/rpm/centos-7/Dockerfile.aarch64 index 591216bcc3..0851a3ee9c 100644 --- a/components/packaging/rpm/centos-7/Dockerfile.aarch64 +++ b/components/packaging/rpm/centos-7/Dockerfile.aarch64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM centos:7 ENV DISTRO centos @@ -11,11 +9,9 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS RUN yum install -y rpm-build rpmlint -RUN rpmlint /root/rpmbuild/SPECS/docker-ce.spec # make sure spec file is ok before installing build deps -RUN yum-builddep -y /root/rpmbuild/SPECS/docker-ce.spec # this always exits 0 so need to rpmlint before running -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec COPY --from=golang /usr/local/go /usr/local/go/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/centos-7/Dockerfile.x86_64 b/components/packaging/rpm/centos-7/Dockerfile.x86_64 index 64e7e12301..b6334f62dd 100644 --- a/components/packaging/rpm/centos-7/Dockerfile.x86_64 +++ b/components/packaging/rpm/centos-7/Dockerfile.x86_64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM centos:7 ENV DISTRO centos @@ -11,11 +9,9 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec RUN yum install -y rpm-build rpmlint -RUN rpmlint /root/rpmbuild/SPECS/docker-ce.spec # make sure spec file is ok before installing build deps -RUN yum-builddep -y /root/rpmbuild/SPECS/docker-ce.spec # this always exits 0 so need to rpmlint before running -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +COPY SPECS /root/rpmbuild/SPECS +RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec COPY --from=golang /usr/local/go /usr/local/go/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/fedora-27/Dockerfile.aarch64 b/components/packaging/rpm/fedora-27/Dockerfile.aarch64 index cf99dd66f5..ee2f8b0860 100644 --- a/components/packaging/rpm/fedora-27/Dockerfile.aarch64 +++ b/components/packaging/rpm/fedora-27/Dockerfile.aarch64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM fedora:27 ENV DISTRO fedora @@ -11,10 +9,9 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec -RUN dnf install -y rpm-build dnf-plugins-core -RUN dnf builddep -y /root/rpmbuild/SPECS/docker-ce.spec -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +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/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/fedora-27/Dockerfile.x86_64 b/components/packaging/rpm/fedora-27/Dockerfile.x86_64 index e9baa01a70..ee2f8b0860 100644 --- a/components/packaging/rpm/fedora-27/Dockerfile.x86_64 +++ b/components/packaging/rpm/fedora-27/Dockerfile.x86_64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM fedora:27 ENV DISTRO fedora @@ -11,10 +9,9 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec -RUN dnf install -y rpm-build dnf-plugins-core -RUN dnf builddep -y /root/rpmbuild/SPECS/docker-ce.spec -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +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/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/fedora-28/Dockerfile.aarch64 b/components/packaging/rpm/fedora-28/Dockerfile.aarch64 index b5395fbbab..797422fa8f 100644 --- a/components/packaging/rpm/fedora-28/Dockerfile.aarch64 +++ b/components/packaging/rpm/fedora-28/Dockerfile.aarch64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-arm64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM fedora:28 ENV DISTRO fedora @@ -11,10 +9,9 @@ ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec -RUN dnf install -y rpm-build dnf-plugins-core -RUN dnf builddep -y /root/rpmbuild/SPECS/docker-ce.spec -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +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/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/fedora-28/Dockerfile.x86_64 b/components/packaging/rpm/fedora-28/Dockerfile.x86_64 index 5786485384..da23b74991 100644 --- a/components/packaging/rpm/fedora-28/Dockerfile.x86_64 +++ b/components/packaging/rpm/fedora-28/Dockerfile.x86_64 @@ -1,7 +1,5 @@ -FROM alpine:latest as golang -RUN apk add curl -ARG GO_VERSION -RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local +ARG GO_IMAGE +FROM ${GO_IMAGE} as golang FROM fedora:28 ENV DISTRO fedora @@ -9,12 +7,10 @@ ENV SUITE 28 ENV GOPATH /go ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin ENV AUTO_GOPATH 1 -ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec -RUN dnf install -y rpm-build dnf-plugins-core -RUN dnf builddep -y /root/rpmbuild/SPECS/docker-ce.spec -RUN mkdir -p /go/src/github.com/docker /go/src/github.com/opencontainers +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/ WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/components/packaging/rpm/systemd/docker.service b/components/packaging/rpm/systemd/docker.service deleted file mode 100644 index 6c60646b56..0000000000 --- a/components/packaging/rpm/systemd/docker.service +++ /dev/null @@ -1,33 +0,0 @@ -[Unit] -Description=Docker Application Container Engine -Documentation=https://docs.docker.com -After=network-online.target firewalld.service -Wants=network-online.target - -[Service] -Type=notify -# the default is not to use systemd for cgroups because the delegate issues still -# exists and systemd currently does not support the cgroup feature set required -# for containers run by docker -ExecStart=/usr/bin/dockerd -ExecReload=/bin/kill -s HUP $MAINPID -# Having non-zero Limit*s causes performance problems due to accounting overhead -# in the kernel. We recommend using cgroups to do container-local accounting. -LimitNOFILE=infinity -LimitNPROC=infinity -LimitCORE=infinity -# Uncomment TasksMax if your systemd version supports it. -# Only systemd 226 and above support this version. -#TasksMax=infinity -TimeoutStartSec=0 -# set delegate yes so that systemd does not reset the cgroups of docker containers -Delegate=yes -# kill only the docker process, not all processes in the cgroup -KillMode=process -# restart the docker process if it exits prematurely -Restart=on-failure -StartLimitBurst=3 -StartLimitInterval=60s - -[Install] -WantedBy=multi-user.target diff --git a/components/packaging/systemd/docker.service b/components/packaging/systemd/docker.service new file mode 100644 index 0000000000..13b2a04750 --- /dev/null +++ b/components/packaging/systemd/docker.service @@ -0,0 +1,18 @@ +[Unit] +Description=Docker Application Container Engine +Documentation=https://docs.docker.com +After=network-online.target firewalld.service containerd.service +Wants=network-online.target containerd.service + +[Service] +# Install containerd-shim-process if it's not already installed +ExecStartPre=/usr/libexec/containerd-offline-installer /var/lib/containerd-offline-installer/containerd-shim-process.tar docker.io/docker/containerd-shim-process +ExecStart=/usr/bin/dockerd +TimeoutSec=0 +Restart=always +# On RPM Based distributions PATH isn't defined so we define it here +# /opt/containerd/bin is in front so dockerd grabs the correct runc binary +Environment="PATH=/opt/containerd/bin:/sbin:/usr/bin:/usr/local/bin:$PATH" + +[Install] +WantedBy=multi-user.target