diff options
-rw-r--r-- | recipes-containers/docker/docker_git.bb | 122 | ||||
-rw-r--r-- | recipes-containers/docker/files/docker.service | 15 | ||||
-rw-r--r-- | recipes-containers/docker/files/hi.Dockerfile | 7 |
3 files changed, 144 insertions, 0 deletions
diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb new file mode 100644 index 00000000..a1d6ff47 --- /dev/null +++ b/recipes-containers/docker/docker_git.bb | |||
@@ -0,0 +1,122 @@ | |||
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 on non-amd64 \ | ||
13 | hosts is not supported at this time. Please be careful when using it \ | ||
14 | on anything besides amd64. \ | ||
15 | . \ | ||
16 | Also, note that kernel version 3.8 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 = "2243e32cbbf1c9809c262a7376d34ca43a7a36dc" | ||
22 | SRC_URI = "\ | ||
23 | git://github.com/docker/docker.git \ | ||
24 | file://docker.service \ | ||
25 | file://hi.Dockerfile \ | ||
26 | " | ||
27 | |||
28 | # Apache-2.0 for docker | ||
29 | LICENSE = "Apache-2.0" | ||
30 | LIC_FILES_CHKSUM = "file://LICENSE;md5=1cc0497778922bfd6cb48721deb80dc7" | ||
31 | |||
32 | S = "${WORKDIR}/git" | ||
33 | |||
34 | DOCKER_VERSION = "1.5.0" | ||
35 | PV = "${DOCKER_VERSION}+git${SRCREV}" | ||
36 | |||
37 | DEPENDS = "golang-cross btrfs-tools sqlite3 " | ||
38 | DEPENDS_append_class-target = "lvm2" | ||
39 | RDEPENDS_${PN} = "curl aufs-util git cgroup-lite util-linux" | ||
40 | RRECOMMENDS_${PN} = "lxc docker-registry rt-tests" | ||
41 | |||
42 | do_compile() { | ||
43 | export GOARCH="${TARGET_ARCH}" | ||
44 | # supported amd64, 386, arm | ||
45 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | ||
46 | export GOARCH="amd64" | ||
47 | fi | ||
48 | |||
49 | # setting AUTO_GOPATH to use the default vendor configuration | ||
50 | # as opposed to setting up GOPATH with all the explicit vendor | ||
51 | # directory structure... | ||
52 | # | ||
53 | # From docker's PACKAGERS.md: | ||
54 | # If you'd rather not be bothered with the hassles that setting up | ||
55 | # `GOPATH` appropriately can be, and prefer to just get a "build | ||
56 | # that works", you should add something similar to this to whatever | ||
57 | # script or process you're using to build Docker | ||
58 | export AUTO_GOPATH=1 | ||
59 | |||
60 | # Pass the needed cflags/ldflags so that cgo | ||
61 | # can find the needed headers files and libraries | ||
62 | export CGO_CFLAGS="${BUILD_CFLAGS}" | ||
63 | export CGO_LDFLAGS="${BUILD_LDFLAGS}" | ||
64 | |||
65 | # this is the unsupported built structure | ||
66 | # that doesn't rely on an existing docker | ||
67 | # to build this: | ||
68 | DOCKER_GITCOMMIT="${SRCREV}" \ | ||
69 | ./hack/make.sh dynbinary | ||
70 | |||
71 | export GOPATH=${S}/vendor | ||
72 | |||
73 | # make nsinit from libcontainer - installed in vendor/bin | ||
74 | ln -s ${S} ${S}/vendor/src/github.com/docker/docker | ||
75 | mkdir -p ${S}/vendor/src/github.com/codegangsta | ||
76 | (cd ${S}/vendor/src/github.com/codegangsta && git clone https://github.com/codegangsta/cli) | ||
77 | go install github.com/docker/libcontainer/nsinit/ | ||
78 | } | ||
79 | |||
80 | inherit systemd | ||
81 | |||
82 | SYSTEMD_PACKAGES = "${@base_contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | ||
83 | SYSTEMD_SERVICE_${PN} = "${@base_contains('DISTRO_FEATURES','systemd','docker.service','',d)}" | ||
84 | |||
85 | do_install() { | ||
86 | mkdir -p ${D}/${bindir} | ||
87 | cp ${S}/bundles/${DOCKER_VERSION}-dev/dynbinary/docker-${DOCKER_VERSION}-dev \ | ||
88 | ${D}/${bindir}/docker | ||
89 | cp ${S}/bundles/${DOCKER_VERSION}-dev/dynbinary/dockerinit-${DOCKER_VERSION}-dev \ | ||
90 | ${D}/${bindir}/dockerinit | ||
91 | |||
92 | if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
93 | install -d ${D}${systemd_unitdir}/system | ||
94 | install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | ||
95 | # replaces one copied from above with one that uses the local registry for a mirror | ||
96 | install -m 644 ${WORKDIR}/docker.service ${D}/${systemd_unitdir}/system | ||
97 | fi | ||
98 | |||
99 | cp ${S}/vendor/bin/nsinit ${D}/${bindir} | ||
100 | |||
101 | mkdir -p ${D}/usr/share/docker/ | ||
102 | cp ${WORKDIR}/hi.Dockerfile ${D}/usr/share/docker/ | ||
103 | } | ||
104 | |||
105 | inherit useradd | ||
106 | USERADD_PACKAGES = "${PN}" | ||
107 | GROUPADD_PARAM_${PN} = "-r docker" | ||
108 | |||
109 | FILES_${PN} += "/lib/systemd/system/*" | ||
110 | |||
111 | # DO NOT STRIP docker and dockerinit!!! | ||
112 | # | ||
113 | # Reason: | ||
114 | # The "docker" package contains two binaries: "docker" and "dockerinit", | ||
115 | # which are both written in Go. The "dockerinit" package is built first, | ||
116 | # then its checksum is given to the build process compiling the "docker" | ||
117 | # binary. Hence the checksum of the unstripped "dockerinit" binary is hard | ||
118 | # coded into the "docker" binary. At runtime the "docker" binary invokes | ||
119 | # the "dockerinit" binary, but before doing that it ensures the checksum | ||
120 | # of "dockerinit" matches with the hard coded value. | ||
121 | # | ||
122 | INHIBIT_PACKAGE_STRIP = "1" | ||
diff --git a/recipes-containers/docker/files/docker.service b/recipes-containers/docker/files/docker.service new file mode 100644 index 00000000..68010319 --- /dev/null +++ b/recipes-containers/docker/files/docker.service | |||
@@ -0,0 +1,15 @@ | |||
1 | [Unit] | ||
2 | Description=Docker Application Container Engine | ||
3 | Documentation=http://docs.docker.com | ||
4 | After=network.target docker.socket | ||
5 | Requires=docker.socket | ||
6 | |||
7 | [Service] | ||
8 | ExecStart=/usr/bin/docker -d -H fd:// --registry-mirror=http://localhost:5000 --insecure-registry=http://localhost:5000 | ||
9 | MountFlags=slave | ||
10 | LimitNOFILE=1048576 | ||
11 | LimitNPROC=1048576 | ||
12 | LimitCORE=infinity | ||
13 | |||
14 | [Install] | ||
15 | WantedBy=multi-user.target | ||
diff --git a/recipes-containers/docker/files/hi.Dockerfile b/recipes-containers/docker/files/hi.Dockerfile new file mode 100644 index 00000000..9af68058 --- /dev/null +++ b/recipes-containers/docker/files/hi.Dockerfile | |||
@@ -0,0 +1,7 @@ | |||
1 | FROM debian | ||
2 | |||
3 | MAINTAINER amy.fong@windriver.com | ||
4 | |||
5 | RUN apt-get update && apt-get install figlet | ||
6 | |||
7 | ENTRYPOINT [ "/usr/bin/figlet", "hi" ] | ||