diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2016-05-02 13:57:43 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2016-05-02 14:02:41 -0400 |
commit | e919b641bbfec86ef328da613a1c47337cb5b26e (patch) | |
tree | 2a1dbaf25a12ee23cb130c1741177e9f09cc8a28 | |
parent | 79654fc6a1b0767a478b115fba93a2ee914c95a7 (diff) | |
download | meta-virtualization-e919b641bbfec86ef328da613a1c47337cb5b26e.tar.gz |
containerd: initial recipe
With the update to docker 1.11.x+, we need the OCI containerd to control
runc:
containerd is a daemon to control runC, built for performance and density.
containerd leverages runC's advanced features such as seccomp and user
namespace support as well as checkpoint and restore for cloning and
live migration of containers.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r-- | recipes-containers/containerd/containerd_git.bb | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/recipes-containers/containerd/containerd_git.bb b/recipes-containers/containerd/containerd_git.bb new file mode 100644 index 00000000..46b9dc1c --- /dev/null +++ b/recipes-containers/containerd/containerd_git.bb | |||
@@ -0,0 +1,86 @@ | |||
1 | HOMEPAGE = "https://github.com/docker/containerd" | ||
2 | SUMMARY = "containerd is a daemon to control runC" | ||
3 | DESCRIPTION = "containerd is a daemon to control runC, built for performance and density. \ | ||
4 | containerd leverages runC's advanced features such as seccomp and user namespace \ | ||
5 | support as well as checkpoint and restore for cloning and live migration of containers." | ||
6 | |||
7 | SRCREV = "ca47f7e76a93e9b3768ed084d62318e85bd9f4b2" | ||
8 | SRC_URI = "\ | ||
9 | git://github.com/docker/containerd.git;nobranch=1 \ | ||
10 | " | ||
11 | |||
12 | # Apache-2.0 for containerd | ||
13 | LICENSE = "Apache-2.0" | ||
14 | LIC_FILES_CHKSUM = "file://LICENSE.code;md5=aadc30f9c14d876ded7bedc0afd2d3d7" | ||
15 | |||
16 | S = "${WORKDIR}/git" | ||
17 | |||
18 | CONTAINERD_VERSION = "0.2.0" | ||
19 | PV = "${CONTAINERD_VERSION}+git${SRCREV}" | ||
20 | |||
21 | DEPENDS = "go-cross \ | ||
22 | " | ||
23 | |||
24 | RRECOMMENDS_${PN} = "lxc docker" | ||
25 | CONTAINERD_PKG="github.com/docker/containerd" | ||
26 | |||
27 | do_configure[noexec] = "1" | ||
28 | |||
29 | do_compile() { | ||
30 | export GOARCH="${TARGET_ARCH}" | ||
31 | # supported amd64, 386, arm arm64 | ||
32 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | ||
33 | export GOARCH="amd64" | ||
34 | fi | ||
35 | if [ "${TARGET_ARCH}" = "aarch64" ]; then | ||
36 | export GOARCH="arm64" | ||
37 | fi | ||
38 | |||
39 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
40 | # docker to download its dependencies but rather | ||
41 | # use dependencies packaged independently. | ||
42 | cd ${S} | ||
43 | rm -rf .gopath | ||
44 | mkdir -p .gopath/src/"$(dirname "${CONTAINERD_PKG}")" | ||
45 | ln -sf ../../../.. .gopath/src/"${CONTAINERD_PKG}" | ||
46 | export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
47 | cd - | ||
48 | |||
49 | # Pass the needed cflags/ldflags so that cgo | ||
50 | # can find the needed headers files and libraries | ||
51 | export CGO_ENABLED="1" | ||
52 | export CFLAGS="" | ||
53 | export LDFLAGS="" | ||
54 | export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
55 | export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
56 | |||
57 | oe_runmake static | ||
58 | } | ||
59 | |||
60 | # Note: disabled for now, since docker is launching containerd | ||
61 | # inherit systemd | ||
62 | # SYSTEMD_PACKAGES = "${@base_contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
63 | # SYSTEMD_SERVICE_${PN} = "${@base_contains('DISTRO_FEATURES','systemd','containerd.service','',d)}" | ||
64 | |||
65 | do_install() { | ||
66 | mkdir -p ${D}/${bindir} | ||
67 | |||
68 | cp ${S}/bin/containerd ${D}/${bindir}/containerd | ||
69 | cp ${S}/bin/containerd-shim ${D}/${bindir}/containerd-shim | ||
70 | cp ${S}/bin/ctr ${D}/${bindir}/containerd-ctr | ||
71 | |||
72 | ln -sf containerd ${D}/${bindir}/docker-containerd | ||
73 | ln -sf containerd-shim ${D}/${bindir}/docker-containerd-shim | ||
74 | ln -sf containerd-ctr ${D}/${bindir}/docker-containerd-ctr | ||
75 | |||
76 | if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
77 | install -d ${D}${systemd_unitdir}/system | ||
78 | install -m 644 ${S}/hack/containerd.service ${D}/${systemd_unitdir}/system | ||
79 | # adjust from /usr/local/bin to /usr/bin/ | ||
80 | sed -e "s:/usr/local/bin/containerd:${bindir}/docker-containerd -l \"unix\:///var/run/docker/libcontainerd/docker-containerd.sock\":g" -i ${D}/${systemd_unitdir}/system/containerd.service | ||
81 | fi | ||
82 | } | ||
83 | |||
84 | FILES_${PN} += "/lib/systemd/system/*" | ||
85 | |||
86 | INHIBIT_PACKAGE_STRIP = "1" | ||