blob: e055a4f607c585548acf7a8ad1d8ff3796e57883 [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 Bishop316dfdd2018-06-25 12:45:53 -040021SRCREV_docker = "708b068d3095c6a6be939eb2da78c921d2e945e2"
22SRCREV_libnetwork = "4cb38c2987c236dce03c868d99b57b1e28a4b81c"
23SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457"
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 Bishop316dfdd2018-06-25 12:45:53 -040026 git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \
27 git://github.com/docker/cli;branch=master;name=cli;destsuffix=git/cli \
Patrick Williamsd849ec72016-08-17 14:59:38 -050028 file://docker.init \
29 file://hi.Dockerfile \
Brad Bishop316dfdd2018-06-25 12:45:53 -040030 file://0001-libnetwork-use-GO-instead-of-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 Bishop316dfdd2018-06-25 12:45:53 -040041DOCKER_VERSION = "18.03.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 \
Brad Bishop316dfdd2018-06-25 12:45:53 -040062 libtool \
Patrick Williamsd849ec72016-08-17 14:59:38 -050063 "
64
Brad Bishop6e60e8b2018-02-01 10:27:11 -050065PACKAGES =+ "${PN}-contrib"
66
67DEPENDS_append_class-target = " lvm2"
Brad Bishop316dfdd2018-06-25 12:45:53 -040068RDEPENDS_${PN} = "util-linux iptables \
69 ${@bb.utils.contains('DISTRO_FEATURES', 'aufs', 'aufs-util', '', d)} \
70 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'cgroup-lite', d)} \
Patrick Williamse69d2352017-02-23 20:56:04 -060071 "
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072RDEPENDS_${PN} += "virtual/containerd virtual/runc"
73
Brad Bishop66783732017-12-04 02:22:08 -050074RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050075RSUGGESTS_${PN} = "lxc rt-tests"
Patrick Williamsd849ec72016-08-17 14:59:38 -050076DOCKER_PKG="github.com/docker/docker"
77
Brad Bishop6e60e8b2018-02-01 10:27:11 -050078inherit systemd update-rc.d
79inherit go
80inherit goarch
Brad Bishop316dfdd2018-06-25 12:45:53 -040081inherit pkgconfig
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082
Patrick Williamsd849ec72016-08-17 14:59:38 -050083do_configure[noexec] = "1"
84
85do_compile() {
Patrick Williamsd849ec72016-08-17 14:59:38 -050086 # Set GOPATH. See 'PACKAGERS.md'. Don't rely on
87 # docker to download its dependencies but rather
88 # use dependencies packaged independently.
Brad Bishopd7bf8c12018-02-25 22:55:05 -050089 cd ${S}/src/import
Patrick Williamsd849ec72016-08-17 14:59:38 -050090 rm -rf .gopath
91 mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
92 ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093
94 mkdir -p .gopath/src/github.com/docker
Brad Bishop316dfdd2018-06-25 12:45:53 -040095 ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
96 ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
Brad Bishop6e60e8b2018-02-01 10:27:11 -050097
Brad Bishopd7bf8c12018-02-25 22:55:05 -050098 export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
Patrick Williamse69d2352017-02-23 20:56:04 -060099 export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500100
101 # Pass the needed cflags/ldflags so that cgo
102 # can find the needed headers files and libraries
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500103 export GOARCH=${TARGET_GOARCH}
Patrick Williamsd849ec72016-08-17 14:59:38 -0500104 export CGO_ENABLED="1"
Patrick Williamse69d2352017-02-23 20:56:04 -0600105 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
106 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500107 # 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
Brad Bishop316dfdd2018-06-25 12:45:53 -0400110 export DISABLE_WARN_OUTSIDE_CONTAINER=1
111
112 cd ${S}/src/import/
113
Patrick Williamsd849ec72016-08-17 14:59:38 -0500114 # this is the unsupported built structure
115 # that doesn't rely on an existing docker
116 # to build this:
Brad Bishop316dfdd2018-06-25 12:45:53 -0400117 VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500118
119 # build the cli
Brad Bishop316dfdd2018-06-25 12:45:53 -0400120 cd ${S}/src/import/.gopath/src/github.com/docker/cli
121 export CFLAGS=""
122 export LDFLAGS=""
123 export DOCKER_VERSION=${DOCKER_VERSION}
124 VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
125
126 # build the proxy
127 cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
128 oe_runmake cross-local
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500129}
Patrick Williamsd849ec72016-08-17 14:59:38 -0500130
Patrick Williamse69d2352017-02-23 20:56:04 -0600131SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
132SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500133
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500134SYSTEMD_AUTO_ENABLE_${PN} = "enable"
135
Patrick Williamse69d2352017-02-23 20:56:04 -0600136INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}"
137INITSCRIPT_NAME_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','docker.init','',d)}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500138INITSCRIPT_PARAMS_${PN} = "defaults"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500139
140do_install() {
141 mkdir -p ${D}/${bindir}
Brad Bishop316dfdd2018-06-25 12:45:53 -0400142 cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500143 cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
Brad Bishop316dfdd2018-06-25 12:45:53 -0400144 cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
Patrick Williamsd849ec72016-08-17 14:59:38 -0500145
Patrick Williamse69d2352017-02-23 20:56:04 -0600146 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
Patrick Williamsd849ec72016-08-17 14:59:38 -0500147 install -d ${D}${systemd_unitdir}/system
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500148 install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
Patrick Williamsd849ec72016-08-17 14:59:38 -0500149 # replaces one copied from above with one that uses the local registry for a mirror
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500150 install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
Patrick Williamse69d2352017-02-23 20:56:04 -0600151 else
152 install -d ${D}${sysconfdir}/init.d
153 install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
Patrick Williamsd849ec72016-08-17 14:59:38 -0500154 fi
155
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500156 mkdir -p ${D}${datadir}/docker/
157 cp ${WORKDIR}/hi.Dockerfile ${D}${datadir}/docker/
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500158 install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/
Patrick Williamsd849ec72016-08-17 14:59:38 -0500159}
160
161inherit useradd
162USERADD_PACKAGES = "${PN}"
163GROUPADD_PARAM_${PN} = "-r docker"
164
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500165FILES_${PN} += "${systemd_unitdir}/system/*"
166
167FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"
168RDEPENDS_${PN}-contrib += "bash"
Patrick Williamsd849ec72016-08-17 14:59:38 -0500169
Patrick Williamse69d2352017-02-23 20:56:04 -0600170# DO NOT STRIP docker
Patrick Williamsd849ec72016-08-17 14:59:38 -0500171INHIBIT_PACKAGE_STRIP = "1"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500172INSANE_SKIP_${PN} += "ldflags"