Add containerd-shim-process installation

Also split off containerd.mk into it's own thing since most of this
stuff will be re-used with debian packaging anyways.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 5513629a1b4868d82a41249eac634edbff51e315
Component: packaging
This commit is contained in:
Eli Uriegas
2018-08-14 03:23:24 +00:00
parent 4db1f97e23
commit 1f463af629
4 changed files with 38 additions and 4 deletions

View File

@ -2,3 +2,4 @@ build
debbuild
rpmbuild
tmp
artifacts

View File

@ -0,0 +1,17 @@
# Common things for containerd functionality
CONTAINERD_PROXY_COMMIT=3337fb47f10892318361b58c8483f19b1ffa8203
CONTAINERD_SHIM_PROCESS_IMAGE=docker.io/docker/containerd-shim-process:a4d1531
# If the docker-containerd.sock is available use that, else use the default containerd.sock
ifeq (,$(wildcard /var/run/docker/containerd/docker-containerd.sock))
CONTAINERD_SOCK:=/var/run/docker/containerd/docker-containerd.sock
else
CONTAINERD_SOCK:=/var/run/containerd/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

View File

@ -1,3 +1,5 @@
include ../containerd.mk
ARCH=$(shell uname -m)
ENGINE_DIR:=$(CURDIR)/../../engine
CLI_DIR:=$(CURDIR)/../../cli
@ -17,11 +19,9 @@ RPMBUILD_FLAGS=-ba\
--define '_origversion $(word 4, $(GEN_RPM_VER))' \
SPECS/docker-ce.spec SPECS/docker-ce-cli.spec
SOURCE_TGZS=containerd-proxy.tgz cli.tgz
SOURCE_TGZS=containerd-proxy.tgz cli.tgz containerd-shim-process.tar
SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_TGZS))
CONTAINERD_PROXY_COMMIT=3337fb47f10892318361b58c8483f19b1ffa8203
.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)
@ -44,6 +44,7 @@ centos: centos-7 ## build all centos rpm packages
.PHONY: fedora-28
fedora-28: ## build fedora-28 rpm packages
fedora-28: $(SOURCES)
$(CHOWN) -R root:root rpmbuild
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
@ -51,6 +52,7 @@ fedora-28: $(SOURCES)
.PHONY: fedora-27
fedora-27: ## build fedora-27 rpm packages
fedora-27: $(SOURCES)
$(CHOWN) -R root:root rpmbuild
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
@ -58,6 +60,7 @@ fedora-27: $(SOURCES)
.PHONY: centos-7
centos-7: ## build centos-7 rpm packages
centos-7: $(SOURCES)
$(CHOWN) -R root:root rpmbuild
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
@ -79,4 +82,10 @@ rpmbuild/SOURCES/containerd-proxy.tgz:
$(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild
tar -zcf $@ -C tmp/ containerd-proxy
rm -rf tmp/
$(CHOWN) -R root:root rpmbuild/SOURCES
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

View File

@ -5,6 +5,7 @@ Version: %{_version}
Release: %{_release}%{?dist}
Epoch: %{getenv:EPOCH}
Source0: containerd-proxy.tgz
Source1: containerd-shim-process.tar
Summary: The open-source application container engine
Group: Tools/Docker
License: ASL 2.0
@ -13,6 +14,8 @@ Vendor: Docker
Packager: Docker <support@docker.com>
Requires: docker-ce-cli
# Should be required as well by docker-ce-cli but let's just be thorough
Requires: containerd.io
# conflicting packages
Conflicts: docker
@ -40,6 +43,7 @@ depending on a particular stack or provider.
%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
@ -47,9 +51,12 @@ go build -v -o /build/dockerd github.com/crosbymichael/containerd-proxy
%install
install -D -m 0755 /build/dockerd $RPM_BUILD_ROOT/%{_bindir}/dockerd
# TODO: Use containerd-offline-installer to actually install this as ExecStartPre systemd step
install -D -m 0644 %{_topdir}/SOURCES/containerd-shim-process.tar $RPM_BUILD_ROOT/%{_sharedstatedir}/containerd/containerd-shim-process.tar
%files
/%{_bindir}/dockerd
/%{_sharedstatedir}/containerd/containerd-shim-process.tar
%post
if ! getent group docker > /dev/null; then