From d357d4ed3d006ebb5048d41b2aac6c76966034d1 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Mon, 6 Aug 2018 18:13:03 +0000 Subject: [PATCH] Add RPM package building for docker-ce-cli Splits out the docker-ce package and docker-ce-cli package into their own things. Still TODO: need to have a cleanup on the dependencies for the Dockerfiles Signed-off-by: Eli Uriegas --- rpm/Makefile | 29 ++--- rpm/SPECS/docker-ce-cli.spec | 100 +++++++++++++++ rpm/SPECS/docker-ce.spec | 51 ++++++++ rpm/centos-7/Dockerfile.aarch64 | 2 +- rpm/centos-7/Dockerfile.x86_64 | 2 +- rpm/centos-7/docker-ce.spec | 208 ------------------------------ rpm/fedora-27/Dockerfile.aarch64 | 2 +- rpm/fedora-27/Dockerfile.x86_64 | 2 +- rpm/fedora-27/docker-ce.spec | 212 ------------------------------- rpm/fedora-28/Dockerfile.aarch64 | 2 +- rpm/fedora-28/Dockerfile.x86_64 | 2 +- rpm/fedora-28/docker-ce.spec | 212 ------------------------------- 12 files changed, 166 insertions(+), 658 deletions(-) create mode 100644 rpm/SPECS/docker-ce-cli.spec create mode 100644 rpm/SPECS/docker-ce.spec delete mode 100644 rpm/centos-7/docker-ce.spec delete mode 100644 rpm/fedora-27/docker-ce.spec delete mode 100644 rpm/fedora-28/docker-ce.spec diff --git a/rpm/Makefile b/rpm/Makefile index c0fe38599d..c8ece2c93a 100644 --- a/rpm/Makefile +++ b/rpm/Makefile @@ -4,23 +4,20 @@ CLI_DIR:=$(CURDIR)/../../cli GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD) VERSION?=0.0.0-dev GO_VERSION:=1.10.3 -GEN_RPM_VER=$(shell ./gen-rpm-ver $(ENGINE_DIR) $(VERSION)) +GEN_RPM_VER=$(shell ./gen-rpm-ver $(CLI_DIR) $(VERSION)) EPOCH?=2 CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown RPMBUILD=docker run --privileged --rm -i\ -e EPOCH="$(EPOCH)" \ -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-cli.spec SPECS/docker-ce.spec .PHONY: help help: ## show make targets @@ -41,20 +38,20 @@ fedora: fedora-28 fedora-27 fedora-26 ## build all fedora rpm packages centos: centos-7 ## build all centos rpm packages .PHONY: fedora-28 -fedora-28: 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: rpmbuild/SOURCES/cli.tgz ## build fedora-28 rpm packages + docker build --build-arg GO_VERSION=$(GO_VERSION) -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: 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: rpmbuild/SOURCES/cli.tgz ## build fedora-27 rpm packages + docker build --build-arg GO_VERSION=$(GO_VERSION) -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: 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: rpmbuild/SOURCES/cli.tgz ## build centos-7 rpm packages + docker build --build-arg GO_VERSION=$(GO_VERSION) -t rpmbuild-$@/$(ARCH) -f $@/Dockerfile.$(ARCH) . $(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS) $(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild @@ -65,11 +62,3 @@ rpmbuild/SOURCES/cli.tgz: -v $(CURDIR)/rpmbuild/SOURCES:/v \ 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 diff --git a/rpm/SPECS/docker-ce-cli.spec b/rpm/SPECS/docker-ce-cli.spec new file mode 100644 index 0000000000..65ba0fbf3e --- /dev/null +++ b/rpm/SPECS/docker-ce-cli.spec @@ -0,0 +1,100 @@ +%global debug_package %{nil} + +Name: docker-ce-cli +Version: %{_version} +Release: %{_release}%{?dist} +Epoch: %{getenv:EPOCH} +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 + +# 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/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec new file mode 100644 index 0000000000..a2e3d25b18 --- /dev/null +++ b/rpm/SPECS/docker-ce.spec @@ -0,0 +1,51 @@ +%global debug_package %{nil} + +Name: docker-ce +Version: %{_version} +Release: %{_release}%{?dist} +Epoch: %{getenv:EPOCH} +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 + +# 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. + +%install + +%files + +%post +if ! getent group docker > /dev/null; then + groupadd --system docker +fi +# TODO Needs upgrade vs. install logic handling here +if ctr --namespace docker container info dockerd > /dev/null 2>&1 ; then + docker engine init +fi + +%changelog diff --git a/rpm/centos-7/Dockerfile.aarch64 b/rpm/centos-7/Dockerfile.aarch64 index 53517be33f..c3edbf27eb 100644 --- a/rpm/centos-7/Dockerfile.aarch64 +++ b/rpm/centos-7/Dockerfile.aarch64 @@ -28,6 +28,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/centos-7/Dockerfile.x86_64 b/rpm/centos-7/Dockerfile.x86_64 index 7cdc495480..3fa620a839 100644 --- a/rpm/centos-7/Dockerfile.x86_64 +++ b/rpm/centos-7/Dockerfile.x86_64 @@ -28,6 +28,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/centos-7/docker-ce.spec b/rpm/centos-7/docker-ce.spec deleted file mode 100644 index 41318c4af9..0000000000 --- a/rpm/centos-7/docker-ce.spec +++ /dev/null @@ -1,208 +0,0 @@ -Name: docker-ce -Version: %{_version} -Release: %{_release}%{?dist} -Epoch: %{getenv:EPOCH} -Summary: The open-source application container engine -Group: Tools/Docker -License: ASL 2.0 -Source0: engine.tgz -Source1: cli.tgz -URL: https://www.docker.com -Vendor: Docker -Packager: Docker - -# DWZ problem with multiple golang binary, see bug -# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 -%global _dwz_low_mem_die_limit 0 -%global is_systemd 1 -%global with_selinux 1 - -BuildRequires: pkgconfig(systemd) -BuildRequires: pkgconfig(libsystemd-journal) - -# required packages on install -Requires: /bin/sh -Requires: container-selinux >= 2.9 -Requires: libseccomp >= 2.3 -Requires: iptables -Requires: libcgroup -Requires: systemd-units -Requires: tar -Requires: xz - -# Resolves: rhbz#1165615 -Requires: device-mapper-libs >= 1.02.90-1 - -# 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 -a 1 - -%build -export DOCKER_GITCOMMIT=%{_gitcommit} -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 -make VERSION=%{_origversion} GITCOMMIT=%{_gitcommit} dynbinary manpages # cli -popd -pushd engine -for component in tini "proxy dynamic" "runc all" "containerd dynamic";do - TMP_GOPATH="/go" hack/dockerfile/install/install.sh $component -done -VERSION=%{_origversion} hack/make.sh dynbinary -popd - -%check -cli/build/docker -v -engine/bundles/dynbinary-daemon/dockerd -v - -%install -# install binary -install -d $RPM_BUILD_ROOT/%{_bindir} -install -p -m 755 cli/build/docker $RPM_BUILD_ROOT/%{_bindir}/docker -install -p -m 755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) $RPM_BUILD_ROOT/%{_bindir}/dockerd - -# install proxy -install -p -m 755 /usr/local/bin/docker-proxy $RPM_BUILD_ROOT/%{_bindir}/docker-proxy - -# install containerd -install -p -m 755 /usr/local/bin/docker-containerd $RPM_BUILD_ROOT/%{_bindir}/docker-containerd -install -p -m 755 /usr/local/bin/docker-containerd-shim $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-shim -install -p -m 755 /usr/local/bin/docker-containerd-ctr $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-ctr - -# install runc -install -p -m 755 /usr/local/bin/docker-runc $RPM_BUILD_ROOT/%{_bindir}/docker-runc - -# install tini -install -p -m 755 /usr/local/bin/docker-init $RPM_BUILD_ROOT/%{_bindir}/docker-init - -# install udev rules -install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d -install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules - -# add init scripts -install -d $RPM_BUILD_ROOT/etc/sysconfig -install -d $RPM_BUILD_ROOT/%{_initddir} -install -d $RPM_BUILD_ROOT/%{_unitdir} -install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service -# 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 - -# add vimfiles -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax -install -p -m 644 engine/contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt -install -p -m 644 engine/contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -install -p -m 644 engine/contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim - -# add nano -install -d $RPM_BUILD_ROOT/usr/share/nano -install -p -m 644 engine/contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc - -mkdir -p build-docs -for engine_file in AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md; do - cp "engine/$engine_file" "build-docs/engine-$engine_file" -done -for cli_file in LICENSE MAINTAINERS NOTICE README.md; do - cp "cli/$cli_file" "build-docs/cli-$cli_file" -done - -# list files owned by the package here -%files -%doc build-docs/engine-AUTHORS build-docs/engine-CHANGELOG.md build-docs/engine-CONTRIBUTING.md build-docs/engine-LICENSE build-docs/engine-MAINTAINERS build-docs/engine-NOTICE build-docs/engine-README.md -%doc build-docs/cli-LICENSE build-docs/cli-MAINTAINERS build-docs/cli-NOTICE build-docs/cli-README.md -/%{_bindir}/docker -/%{_bindir}/dockerd -/%{_bindir}/docker-containerd -/%{_bindir}/docker-containerd-shim -/%{_bindir}/docker-containerd-ctr -/%{_bindir}/docker-proxy -/%{_bindir}/docker-runc -/%{_bindir}/docker-init -/%{_sysconfdir}/udev/rules.d/80-docker.rules -/%{_unitdir}/docker.service -/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/* -/usr/share/vim/vimfiles/doc/dockerfile.txt -/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -/usr/share/vim/vimfiles/syntax/dockerfile.vim -/usr/share/nano/Dockerfile.nanorc - -%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/rpm/fedora-27/Dockerfile.aarch64 b/rpm/fedora-27/Dockerfile.aarch64 index c62395c725..1abeda58bc 100644 --- a/rpm/fedora-27/Dockerfile.aarch64 +++ b/rpm/fedora-27/Dockerfile.aarch64 @@ -12,6 +12,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-27/Dockerfile.x86_64 b/rpm/fedora-27/Dockerfile.x86_64 index f55cadba5d..3c300ac153 100644 --- a/rpm/fedora-27/Dockerfile.x86_64 +++ b/rpm/fedora-27/Dockerfile.x86_64 @@ -12,6 +12,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-27/docker-ce.spec b/rpm/fedora-27/docker-ce.spec deleted file mode 100644 index cc13455dd1..0000000000 --- a/rpm/fedora-27/docker-ce.spec +++ /dev/null @@ -1,212 +0,0 @@ -Name: docker-ce -Version: %{_version} -Release: %{_release}%{?dist} -Epoch: %{getenv:EPOCH} -Summary: The open-source application container engine -Group: Tools/Docker -License: ASL 2.0 -Source0: engine.tgz -Source1: cli.tgz -URL: https://www.docker.com -Vendor: Docker -Packager: Docker - -# DWZ problem with multiple golang binary, see bug -# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 -%global _dwz_low_mem_die_limit 0 -%global is_systemd 1 -%global with_selinux 1 -%global _missing_build_ids_terminate_build 0 - -BuildRequires: pkgconfig(systemd) - -# required packages on install -Requires: /bin/sh -Requires: container-selinux >= 2.9 -Requires: iptables -Requires: libcgroup -Requires: systemd-units -Requires: tar -Requires: xz -Requires: pigz - -# Resolves: rhbz#1165615 -Requires: device-mapper-libs >= 1.02.90-1 - -# 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 -a 1 - -%build -export DOCKER_GITCOMMIT=%{_gitcommit} -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 -make VERSION=%{_origversion} GITCOMMIT=%{_gitcommit} dynbinary manpages # cli -popd -pushd engine -for component in tini "proxy dynamic" "runc all" "containerd dynamic";do - TMP_GOPATH="/go" hack/dockerfile/install/install.sh $component -done -VERSION=%{_origversion} hack/make.sh dynbinary -popd -mkdir -p plugin -printf '{"edition_type":"ce","edition_name":"%s","edition_version":"%s"}\n' "${DISTRO}" "%{_version}" > plugin/.plugin-metadata - -%check -cli/build/docker -v -engine/bundles/dynbinary-daemon/dockerd -v - -%install -# install binary -install -d $RPM_BUILD_ROOT/%{_bindir} -install -p -m 755 cli/build/docker $RPM_BUILD_ROOT/%{_bindir}/docker -install -p -m 755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) $RPM_BUILD_ROOT/%{_bindir}/dockerd - -# install proxy -install -p -m 755 /usr/local/bin/docker-proxy $RPM_BUILD_ROOT/%{_bindir}/docker-proxy - -# install containerd -install -p -m 755 /usr/local/bin/docker-containerd $RPM_BUILD_ROOT/%{_bindir}/docker-containerd -install -p -m 755 /usr/local/bin/docker-containerd-shim $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-shim -install -p -m 755 /usr/local/bin/docker-containerd-ctr $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-ctr - -# install runc -install -p -m 755 /usr/local/bin/docker-runc $RPM_BUILD_ROOT/%{_bindir}/docker-runc - -# install tini -install -p -m 755 /usr/local/bin/docker-init $RPM_BUILD_ROOT/%{_bindir}/docker-init - -# install udev rules -install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d -install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules - -# add init scripts -install -d $RPM_BUILD_ROOT/etc/sysconfig -install -d $RPM_BUILD_ROOT/%{_initddir} -install -d $RPM_BUILD_ROOT/%{_unitdir} -# Fedora 25+ supports (and needs) TasksMax -sed -i 's/^#TasksMax=/TasksMax=/' /systemd/docker.service -install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service -# 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 - -# add vimfiles -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax -install -p -m 644 engine/contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt -install -p -m 644 engine/contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -install -p -m 644 engine/contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim - -# add nano -install -d $RPM_BUILD_ROOT/usr/share/nano -install -p -m 644 engine/contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc - -mkdir -p build-docs -for engine_file in AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md; do - cp "engine/$engine_file" "build-docs/engine-$engine_file" -done -for cli_file in LICENSE MAINTAINERS NOTICE README.md; do - cp "cli/$cli_file" "build-docs/cli-$cli_file" -done - -# list files owned by the package here -%files -%doc build-docs/engine-AUTHORS build-docs/engine-CHANGELOG.md build-docs/engine-CONTRIBUTING.md build-docs/engine-LICENSE build-docs/engine-MAINTAINERS build-docs/engine-NOTICE build-docs/engine-README.md -%doc build-docs/cli-LICENSE build-docs/cli-MAINTAINERS build-docs/cli-NOTICE build-docs/cli-README.md -/%{_bindir}/docker -/%{_bindir}/dockerd -/%{_bindir}/docker-containerd -/%{_bindir}/docker-containerd-shim -/%{_bindir}/docker-containerd-ctr -/%{_bindir}/docker-proxy -/%{_bindir}/docker-runc -/%{_bindir}/docker-init -/%{_sysconfdir}/udev/rules.d/80-docker.rules -/%{_unitdir}/docker.service -/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/* -/usr/share/vim/vimfiles/doc/dockerfile.txt -/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -/usr/share/vim/vimfiles/syntax/dockerfile.vim -/usr/share/nano/Dockerfile.nanorc - -%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/rpm/fedora-28/Dockerfile.aarch64 b/rpm/fedora-28/Dockerfile.aarch64 index f8f68512f4..a0aa4a055c 100644 --- a/rpm/fedora-28/Dockerfile.aarch64 +++ b/rpm/fedora-28/Dockerfile.aarch64 @@ -12,6 +12,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-28/Dockerfile.x86_64 b/rpm/fedora-28/Dockerfile.x86_64 index b5db207950..bebfe0cf9c 100644 --- a/rpm/fedora-28/Dockerfile.x86_64 +++ b/rpm/fedora-28/Dockerfile.x86_64 @@ -12,6 +12,6 @@ ENV AUTO_GOPATH 1 ENV DOCKER_BUILDTAGS pkcs11 seccomp selinux ENV RUNC_BUILDTAGS seccomp selinux RUN mkdir -p /go/src/github.com/docker && mkdir -p /go/src/github.com/opencontainers -COPY docker-ce.spec /root/rpmbuild/SPECS/docker-ce.spec +COPY SPECS /root/rpmbuild/SPECS WORKDIR /root/rpmbuild ENTRYPOINT ["/bin/rpmbuild"] diff --git a/rpm/fedora-28/docker-ce.spec b/rpm/fedora-28/docker-ce.spec deleted file mode 100644 index cc13455dd1..0000000000 --- a/rpm/fedora-28/docker-ce.spec +++ /dev/null @@ -1,212 +0,0 @@ -Name: docker-ce -Version: %{_version} -Release: %{_release}%{?dist} -Epoch: %{getenv:EPOCH} -Summary: The open-source application container engine -Group: Tools/Docker -License: ASL 2.0 -Source0: engine.tgz -Source1: cli.tgz -URL: https://www.docker.com -Vendor: Docker -Packager: Docker - -# DWZ problem with multiple golang binary, see bug -# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 -%global _dwz_low_mem_die_limit 0 -%global is_systemd 1 -%global with_selinux 1 -%global _missing_build_ids_terminate_build 0 - -BuildRequires: pkgconfig(systemd) - -# required packages on install -Requires: /bin/sh -Requires: container-selinux >= 2.9 -Requires: iptables -Requires: libcgroup -Requires: systemd-units -Requires: tar -Requires: xz -Requires: pigz - -# Resolves: rhbz#1165615 -Requires: device-mapper-libs >= 1.02.90-1 - -# 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 -a 1 - -%build -export DOCKER_GITCOMMIT=%{_gitcommit} -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 -make VERSION=%{_origversion} GITCOMMIT=%{_gitcommit} dynbinary manpages # cli -popd -pushd engine -for component in tini "proxy dynamic" "runc all" "containerd dynamic";do - TMP_GOPATH="/go" hack/dockerfile/install/install.sh $component -done -VERSION=%{_origversion} hack/make.sh dynbinary -popd -mkdir -p plugin -printf '{"edition_type":"ce","edition_name":"%s","edition_version":"%s"}\n' "${DISTRO}" "%{_version}" > plugin/.plugin-metadata - -%check -cli/build/docker -v -engine/bundles/dynbinary-daemon/dockerd -v - -%install -# install binary -install -d $RPM_BUILD_ROOT/%{_bindir} -install -p -m 755 cli/build/docker $RPM_BUILD_ROOT/%{_bindir}/docker -install -p -m 755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) $RPM_BUILD_ROOT/%{_bindir}/dockerd - -# install proxy -install -p -m 755 /usr/local/bin/docker-proxy $RPM_BUILD_ROOT/%{_bindir}/docker-proxy - -# install containerd -install -p -m 755 /usr/local/bin/docker-containerd $RPM_BUILD_ROOT/%{_bindir}/docker-containerd -install -p -m 755 /usr/local/bin/docker-containerd-shim $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-shim -install -p -m 755 /usr/local/bin/docker-containerd-ctr $RPM_BUILD_ROOT/%{_bindir}/docker-containerd-ctr - -# install runc -install -p -m 755 /usr/local/bin/docker-runc $RPM_BUILD_ROOT/%{_bindir}/docker-runc - -# install tini -install -p -m 755 /usr/local/bin/docker-init $RPM_BUILD_ROOT/%{_bindir}/docker-init - -# install udev rules -install -d $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d -install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/80-docker.rules - -# add init scripts -install -d $RPM_BUILD_ROOT/etc/sysconfig -install -d $RPM_BUILD_ROOT/%{_initddir} -install -d $RPM_BUILD_ROOT/%{_unitdir} -# Fedora 25+ supports (and needs) TasksMax -sed -i 's/^#TasksMax=/TasksMax=/' /systemd/docker.service -install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service -# 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 - -# add vimfiles -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect -install -d $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax -install -p -m 644 engine/contrib/syntax/vim/doc/dockerfile.txt $RPM_BUILD_ROOT/usr/share/vim/vimfiles/doc/dockerfile.txt -install -p -m 644 engine/contrib/syntax/vim/ftdetect/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -install -p -m 644 engine/contrib/syntax/vim/syntax/dockerfile.vim $RPM_BUILD_ROOT/usr/share/vim/vimfiles/syntax/dockerfile.vim - -# add nano -install -d $RPM_BUILD_ROOT/usr/share/nano -install -p -m 644 engine/contrib/syntax/nano/Dockerfile.nanorc $RPM_BUILD_ROOT/usr/share/nano/Dockerfile.nanorc - -mkdir -p build-docs -for engine_file in AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE MAINTAINERS NOTICE README.md; do - cp "engine/$engine_file" "build-docs/engine-$engine_file" -done -for cli_file in LICENSE MAINTAINERS NOTICE README.md; do - cp "cli/$cli_file" "build-docs/cli-$cli_file" -done - -# list files owned by the package here -%files -%doc build-docs/engine-AUTHORS build-docs/engine-CHANGELOG.md build-docs/engine-CONTRIBUTING.md build-docs/engine-LICENSE build-docs/engine-MAINTAINERS build-docs/engine-NOTICE build-docs/engine-README.md -%doc build-docs/cli-LICENSE build-docs/cli-MAINTAINERS build-docs/cli-NOTICE build-docs/cli-README.md -/%{_bindir}/docker -/%{_bindir}/dockerd -/%{_bindir}/docker-containerd -/%{_bindir}/docker-containerd-shim -/%{_bindir}/docker-containerd-ctr -/%{_bindir}/docker-proxy -/%{_bindir}/docker-runc -/%{_bindir}/docker-init -/%{_sysconfdir}/udev/rules.d/80-docker.rules -/%{_unitdir}/docker.service -/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/* -/usr/share/vim/vimfiles/doc/dockerfile.txt -/usr/share/vim/vimfiles/ftdetect/dockerfile.vim -/usr/share/vim/vimfiles/syntax/dockerfile.vim -/usr/share/nano/Dockerfile.nanorc - -%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