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 <eli.uriegas@docker.com> Upstream-commit: 2a27fb1dad0f91c25acb885c117563a33f6c5e88 Component: packaging
This commit is contained in:
@ -4,21 +4,18 @@ 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))
|
||||
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-cli.spec SPECS/docker-ce.spec
|
||||
|
||||
.PHONY: help
|
||||
help: ## show make targets
|
||||
@ -43,20 +40,20 @@ engine-$(ARCH).tar:
|
||||
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: engine-$(ARCH).tar 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: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: engine-$(ARCH).tar 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: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: engine-$(ARCH).tar 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
|
||||
|
||||
@ -67,11 +64,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
|
||||
|
||||
100
components/packaging/rpm/SPECS/docker-ce-cli.spec
Normal file
100
components/packaging/rpm/SPECS/docker-ce-cli.spec
Normal file
@ -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 <support@docker.com>
|
||||
|
||||
# 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
|
||||
51
components/packaging/rpm/SPECS/docker-ce.spec
Normal file
51
components/packaging/rpm/SPECS/docker-ce.spec
Normal file
@ -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 <support@docker.com>
|
||||
|
||||
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
|
||||
@ -11,11 +11,10 @@ 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 rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@ -11,11 +11,10 @@ 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 rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@ -11,10 +11,10 @@ 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 yum install -y rpm-build rpmlint
|
||||
COPY SPECS /root/rpmbuild/SPECS
|
||||
RUN rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@ -11,10 +11,10 @@ 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 yum install -y rpm-build rpmlint
|
||||
COPY SPECS /root/rpmbuild/SPECS
|
||||
RUN rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@ -11,10 +11,10 @@ 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 yum install -y rpm-build rpmlint
|
||||
COPY SPECS /root/rpmbuild/SPECS
|
||||
RUN rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
@ -9,12 +9,11 @@ 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 yum install -y rpm-build rpmlint
|
||||
COPY SPECS /root/rpmbuild/SPECS
|
||||
RUN rpmlint /root/rpmbuild/SPECS/*.spec # make sure spec file is ok before installing build deps
|
||||
RUN yum-builddep -y /root/rpmbuild/SPECS/*.spec # this always exits 0 so need to rpmlint before running
|
||||
COPY --from=golang /usr/local/go /usr/local/go/
|
||||
WORKDIR /root/rpmbuild
|
||||
ENTRYPOINT ["/bin/rpmbuild"]
|
||||
|
||||
Reference in New Issue
Block a user