diff options
| author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-04-02 00:35:02 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-04-02 00:35:02 -0400 |
| commit | f5fbfa8ac4db1bab693e8f162dcab992787f244d (patch) | |
| tree | a2d2bc0224666675f3087f4d9da3d59fbdca053e | |
| parent | a5074cecf18faea1a325c8ac9220d2df41250af5 (diff) | |
| download | meta-virtualization-f5fbfa8ac4db1bab693e8f162dcab992787f244d.tar.gz | |
docker-ce: introduce reference recipe/build
This commit introduces a docker-ce reference recipe that is nearly
identical to the docker_git recipe.
The main difference between these two recipes is that one builds from
moby and this one from the docker-ce repository itself. The different
repositories mean that a different selection of commits are used and
that the build locations change slightly.
Although both docker_git and this recipe share nearly all their code,
they will vary more in the future, and prematurely factoring them
into a .inc file is not practical (until this proves useful).
Future work: remove the individual libnetwork and cli repository
fetches and build the components directly from the docker-ce repo.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
| -rw-r--r-- | recipes-containers/docker/docker-ce_git.bb | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/recipes-containers/docker/docker-ce_git.bb b/recipes-containers/docker/docker-ce_git.bb new file mode 100644 index 00000000..0dfda5f1 --- /dev/null +++ b/recipes-containers/docker/docker-ce_git.bb | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | HOMEPAGE = "http://www.docker.com" | ||
| 2 | SUMMARY = "Linux container runtime" | ||
| 3 | DESCRIPTION = "Linux container runtime \ | ||
| 4 | Docker complements kernel namespacing with a high-level API which \ | ||
| 5 | operates at the process level. It runs unix processes with strong \ | ||
| 6 | guarantees of isolation and repeatability across servers. \ | ||
| 7 | . \ | ||
| 8 | Docker is a great building block for automating distributed systems: \ | ||
| 9 | large-scale web deployments, database clusters, continuous deployment \ | ||
| 10 | systems, private PaaS, service-oriented architectures, etc. \ | ||
| 11 | . \ | ||
| 12 | This package contains the daemon and client. Using docker.io is \ | ||
| 13 | officially supported on x86_64 and arm (32-bit) hosts. \ | ||
| 14 | Other architectures are considered experimental. \ | ||
| 15 | . \ | ||
| 16 | Also, note that kernel version 3.10 or above is required for proper \ | ||
| 17 | operation of the daemon process, and that any lower versions may have \ | ||
| 18 | subtle and/or glaring issues. \ | ||
| 19 | " | ||
| 20 | |||
| 21 | SRCREV_docker = "0520e243029d1361649afb0706a1c5d9a1c012b8" | ||
| 22 | SRCREV_libnetwork = "4cb38c2987c236dce03c868d99b57b1e28a4b81c" | ||
| 23 | SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457" | ||
| 24 | SRC_URI = "\ | ||
| 25 | git://github.com/docker/docker-ce.git;nobranch=1;name=docker \ | ||
| 26 | git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \ | ||
| 27 | git://github.com/docker/cli;branch=master;name=cli;destsuffix=cli \ | ||
| 28 | file://docker.init \ | ||
| 29 | file://hi.Dockerfile \ | ||
| 30 | " | ||
| 31 | |||
| 32 | # Apache-2.0 for docker | ||
| 33 | LICENSE = "Apache-2.0" | ||
| 34 | LIC_FILES_CHKSUM = "file://src/import/components/engine/LICENSE;md5=9740d093a080530b5c5c6573df9af45a" | ||
| 35 | |||
| 36 | GO_IMPORT = "import" | ||
| 37 | |||
| 38 | S = "${WORKDIR}/git" | ||
| 39 | |||
| 40 | DOCKER_VERSION = "18.03.0-ce" | ||
| 41 | PV = "${DOCKER_VERSION}+git${SRCREV_docker}" | ||
| 42 | |||
| 43 | DEPENDS = " \ | ||
| 44 | go-cli \ | ||
| 45 | go-pty \ | ||
| 46 | go-context \ | ||
| 47 | go-mux \ | ||
| 48 | go-patricia \ | ||
| 49 | go-logrus \ | ||
| 50 | go-fsnotify \ | ||
| 51 | go-dbus \ | ||
| 52 | go-capability \ | ||
| 53 | go-systemd \ | ||
| 54 | btrfs-tools \ | ||
| 55 | sqlite3 \ | ||
| 56 | go-distribution \ | ||
| 57 | compose-file \ | ||
| 58 | go-connections \ | ||
| 59 | notary \ | ||
| 60 | grpc-go \ | ||
| 61 | libtool-native \ | ||
| 62 | libtool \ | ||
| 63 | " | ||
| 64 | |||
| 65 | PACKAGES =+ "${PN}-contrib" | ||
| 66 | |||
| 67 | DEPENDS_append_class-target = " lvm2" | ||
| 68 | RDEPENDS_${PN} = "util-linux iptables \ | ||
| 69 | ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \ | ||
| 70 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \ | ||
| 71 | " | ||
| 72 | RDEPENDS_${PN} += "virtual/containerd virtual/runc" | ||
| 73 | |||
| 74 | RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" | ||
| 75 | RSUGGESTS_${PN} = "lxc rt-tests" | ||
| 76 | DOCKER_PKG="github.com/docker/docker" | ||
| 77 | |||
| 78 | inherit systemd update-rc.d | ||
| 79 | inherit go | ||
| 80 | inherit goarch | ||
| 81 | inherit pkgconfig | ||
| 82 | |||
| 83 | do_configure[noexec] = "1" | ||
| 84 | |||
| 85 | do_compile() { | ||
| 86 | # Set GOPATH. See 'PACKAGERS.md'. Don't rely on | ||
| 87 | # docker to download its dependencies but rather | ||
| 88 | # use dependencies packaged independently. | ||
| 89 | cd ${S}/src/import | ||
| 90 | rm -rf .gopath | ||
| 91 | mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")" | ||
| 92 | ln -sf ../../../../components/engine/ .gopath/src/"${DOCKER_PKG}" | ||
| 93 | |||
| 94 | mkdir -p .gopath/src/github.com/docker | ||
| 95 | ln -sf ${WORKDIR}/libnetwork .gopath/src/github.com/docker/libnetwork | ||
| 96 | ln -sf ${WORKDIR}/cli .gopath/src/github.com/docker/cli | ||
| 97 | |||
| 98 | export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go" | ||
| 99 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
| 100 | |||
| 101 | # Pass the needed cflags/ldflags so that cgo | ||
| 102 | # can find the needed headers files and libraries | ||
| 103 | export GOARCH=${TARGET_GOARCH} | ||
| 104 | export CGO_ENABLED="1" | ||
| 105 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 106 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 107 | # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056 | ||
| 108 | export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper' | ||
| 109 | |||
| 110 | export DISABLE_WARN_OUTSIDE_CONTAINER=1 | ||
| 111 | |||
| 112 | cd ${S}/src/import/components/engine | ||
| 113 | |||
| 114 | # this is the unsupported built structure | ||
| 115 | # that doesn't rely on an existing docker | ||
| 116 | # to build this: | ||
| 117 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary | ||
| 118 | |||
| 119 | # build the proxy | ||
| 120 | go build -o ${S}/src/import/docker-proxy github.com/docker/libnetwork/cmd/proxy | ||
| 121 | |||
| 122 | # build the cli | ||
| 123 | ##go build -o ${S}/src/import/bundles/latest/dynbinary-client/docker github.com/docker/cli/cmd/docker | ||
| 124 | cd ${S}/src/import/.gopath/src/github.com/docker/cli | ||
| 125 | export CFLAGS="" | ||
| 126 | export LDFLAGS="" | ||
| 127 | export DOCKER_VERSION=${DOCKER_VERSION} | ||
| 128 | VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary | ||
| 129 | } | ||
| 130 | |||
| 131 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
| 132 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}" | ||
| 133 | |||
| 134 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" | ||
| 135 | |||
| 136 | INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" | ||
| 137 | INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}" | ||
| 138 | INITSCRIPT_PARAMS_${PN} = "defaults" | ||
| 139 | |||
| 140 | do_install() { | ||
| 141 | mkdir -p ${D}/${bindir} | ||
| 142 | cp ${WORKDIR}/cli/build/docker ${D}/${bindir}/docker | ||
| 143 | cp ${S}/src/import/components/engine/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd | ||
| 144 | cp ${S}/src/import/docker-proxy ${D}/${bindir}/docker-proxy | ||
| 145 | |||
| 146 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
| 147 | install -d ${D}${systemd_unitdir}/system | ||
| 148 | install -m 644 ${S}/src/import/components/engine/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
| 149 | # replaces one copied from above with one that uses the local registry for a mirror | ||
| 150 | install -m 644 ${S}/src/import/components/engine/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | ||
| 151 | else | ||
| 152 | install -d ${D}${sysconfdir}/init.d | ||
| 153 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | ||
| 154 | fi | ||
| 155 | |||
| 156 | mkdir -p ${D}${datadir}/docker/ | ||
| 157 | cp ${WORKDIR}/hi.Dockerfile ${D}${datadir}/docker/ | ||
| 158 | install -m 0755 ${S}/src/import/components/engine/contrib/check-config.sh ${D}${datadir}/docker/ | ||
| 159 | } | ||
| 160 | |||
| 161 | inherit useradd | ||
| 162 | USERADD_PACKAGES = "${PN}" | ||
| 163 | GROUPADD_PARAM_${PN} = "-r docker" | ||
| 164 | |||
| 165 | FILES_${PN} += "${systemd_unitdir}/system/*" | ||
| 166 | |||
| 167 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | ||
| 168 | RDEPENDS_${PN}-contrib += "bash" | ||
| 169 | |||
| 170 | # DO NOT STRIP docker | ||
| 171 | INHIBIT_PACKAGE_STRIP = "1" | ||
| 172 | INSANE_SKIP_${PN} += "ldflags" | ||
