blob: 4ba5e817bf39d61ed185f6ae9ee21d9b5fae1e92 [file] [log] [blame]
Patrick Williamsd849ec72016-08-17 14:59:38 -05001HOMEPAGE = "http://www.docker.com"
2SUMMARY = "Linux container runtime"
3DESCRIPTION = "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 . \
Patrick Williamse69d2352017-02-23 20:56:04 -060012 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. \
Patrick Williamsd849ec72016-08-17 14:59:38 -050015 . \
Patrick Williamse69d2352017-02-23 20:56:04 -060016 Also, note that kernel version 3.10 or above is required for proper \
Patrick Williamsd849ec72016-08-17 14:59:38 -050017 operation of the daemon process, and that any lower versions may have \
18 subtle and/or glaring issues. \
19 "
20
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021SRCREV_docker = "e639a70fbe999d96354a5bcf560231b7b8aa935c"
22SRCREV_libnetwork = "26addf43a5d925ff79d262dbbdb5344bc2b6e198"
23SRCREV_cli = "a765218f1988e85b68aa3977f34893ec7b059a60"
Patrick Williamsd849ec72016-08-17 14:59:38 -050024SRC_URI = "\
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 git://github.com/moby/moby.git;nobranch=1;name=docker \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050026 git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 git://github.com/docker/cli;branch=master;name=cli;destsuffix=cli \
Patrick Williamsd849ec72016-08-17 14:59:38 -050028 file://docker.init \
29 file://hi.Dockerfile \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050030 file://context-use-golang.org-x-net-pkg-until-we-move-to-go.patch \
Patrick Williamsd849ec72016-08-17 14:59:38 -050031 "
32
33# Apache-2.0 for docker
34LICENSE = "Apache-2.0"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=9740d093a080530b5c5c6573df9af45a"
36
37GO_IMPORT = "import"
Patrick Williamsd849ec72016-08-17 14:59:38 -050038
39S = "${WORKDIR}/git"
40
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041DOCKER_VERSION = "17.06.0"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050042PV = "${DOCKER_VERSION}+git${SRCREV_docker}"
Patrick Williamsd849ec72016-08-17 14:59:38 -050043
Patrick Williamse69d2352017-02-23 20:56:04 -060044DEPENDS = " \
Patrick Williamsd849ec72016-08-17 14:59:38 -050045 go-cli \
46 go-pty \
47 go-context \
48 go-mux \
49 go-patricia \
Patrick Williamsd849ec72016-08-17 14:59:38 -050050 go-logrus \
51 go-fsnotify \
52 go-dbus \
53 go-capability \
54 go-systemd \
55 btrfs-tools \
56 sqlite3 \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057 go-distribution \
58 compose-file \
59 go-connections \
60 notary \
61 grpc-go \
Patrick Williamsd849ec72016-08-17 14:59:38 -050062 "
63
Brad Bishop6e60e8b2018-02-01 10:27:11 -050064PACKAGES =+ "${PN}-contrib"
65
66DEPENDS_append_class-target = " lvm2"
Patrick Williamse69d2352017-02-23 20:56:04 -060067RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \
68 ${@bb.utils.contains('DISTRO_FEATURES','systemd','','cgroup-lite',d)} \
69 "
Brad Bishop6e60e8b2018-02-01 10:27:11 -050070RDEPENDS_${PN} += "virtual/containerd virtual/runc"
71
Brad Bishop66783732017-12-04 02:22:08 -050072RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073RSUGGESTS_${PN} = "lxc rt-tests"
Patrick Williamsd849ec72016-08-17 14:59:38 -050074DOCKER_PKG="github.com/docker/docker"
75
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076inherit systemd update-rc.d
77inherit go
78inherit goarch
79
Patrick Williamsd849ec72016-08-17 14:59:38 -050080do_configure[noexec] = "1"
81
82do_compile() {
Patrick Williamsd849ec72016-08-17 14:59:38 -050083 # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
84 # docker to download its dependencies but rather
85 # use dependencies packaged independently.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050086 cd ${S}/src/import
Patrick Williamsd849ec72016-08-17 14:59:38 -050087 rm -rf .gopath
88 mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
89 ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050090
91 mkdir -p .gopath/src/github.com/docker
Brad Bishopd7bf8c12018-02-25 22:55:05 -050092 ln -sf ${WORKDIR}/libnetwork .gopath/src/github.com/docker/libnetwork
93 ln -sf ${WORKDIR}/cli .gopath/src/github.com/docker/cli
Brad Bishop6e60e8b2018-02-01 10:27:11 -050094
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
Patrick Williamse69d2352017-02-23 20:56:04 -060096 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
Patrick Williamsd849ec72016-08-17 14:59:38 -050097
98 # Pass the needed cflags/ldflags so that cgo
99 # can find the needed headers files and libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500100 export GOARCH=${TARGET_GOARCH}
Patrick Williamsd849ec72016-08-17 14:59:38 -0500101 export CGO_ENABLED="1"
Patrick Williamse69d2352017-02-23 20:56:04 -0600102 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
103 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500104 # in order to exclude devicemapper and btrfs - https://github.com/docker/docker/issues/14056
105 export DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdriver_devicemapper'
106
107 # this is the unsupported built structure
108 # that doesn't rely on an existing docker
109 # to build this:
110 DOCKER_GITCOMMIT="${SRCREV}" \
111 ./hack/make.sh dynbinary
Patrick Williamsd849ec72016-08-17 14:59:38 -0500112
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500113 # build the proxy
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500114 go build -o ${S}/src/import/docker-proxy github.com/docker/libnetwork/cmd/proxy
115
116 # build the cli
117 go build -o ${S}/src/import/bundles/latest/dynbinary-client/docker github.com/docker/cli/cmd/docker
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500118}
Patrick Williamsd849ec72016-08-17 14:59:38 -0500119
Patrick Williamse69d2352017-02-23 20:56:04 -0600120SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
121SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500122
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500123SYSTEMD_AUTO_ENABLE_${PN} = "enable"
124
Patrick Williamse69d2352017-02-23 20:56:04 -0600125INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
126INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500127INITSCRIPT_PARAMS_${PN} = "defaults"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500128
129do_install() {
130 mkdir -p ${D}/${bindir}
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500131 cp ${S}/src/import/bundles/latest/dynbinary-client/docker ${D}/${bindir}/docker
132 cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
133 cp ${S}/src/import/docker-proxy ${D}/${bindir}/docker-proxy
Patrick Williamsd849ec72016-08-17 14:59:38 -0500134
Patrick Williamse69d2352017-02-23 20:56:04 -0600135 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
Patrick Williamsd849ec72016-08-17 14:59:38 -0500136 install -d ${D}${systemd_unitdir}/system
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500137 install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
Patrick Williamsd849ec72016-08-17 14:59:38 -0500138 # replaces one copied from above with one that uses the local registry for a mirror
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500139 install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
Patrick Williamse69d2352017-02-23 20:56:04 -0600140 else
141 install -d ${D}${sysconfdir}/init.d
142 install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
Patrick Williamsd849ec72016-08-17 14:59:38 -0500143 fi
144
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500145 mkdir -p ${D}${datadir}/docker/
146 cp ${WORKDIR}/hi.Dockerfile ${D}${datadir}/docker/
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500147 install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/
Patrick Williamsd849ec72016-08-17 14:59:38 -0500148}
149
150inherit useradd
151USERADD_PACKAGES = "${PN}"
152GROUPADD_PARAM_${PN} = "-r docker"
153
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500154FILES_${PN} += "${systemd_unitdir}/system/*"
155
156FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"
157RDEPENDS_${PN}-contrib += "bash"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500158
Patrick Williamse69d2352017-02-23 20:56:04 -0600159# DO NOT STRIP docker
Patrick Williamsd849ec72016-08-17 14:59:38 -0500160INHIBIT_PACKAGE_STRIP = "1"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500161INSANE_SKIP_${PN} += "ldflags"