diff options
author | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-03-11 23:37:36 -0500 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2017-03-12 00:32:33 -0500 |
commit | 5c501c8ec8812fbf8027bc9f46ed635ff15d96e6 (patch) | |
tree | 7679281e5b6c6cdf6625d7fd7385b740737a9730 | |
parent | c5cd21af5f27309c7926b781852e1ef22940a10d (diff) | |
download | meta-virtualization-5c501c8ec8812fbf8027bc9f46ed635ff15d96e6.tar.gz |
docker-registry: provide via docker-distribution
Follow the bouncing docker-registry package. Rather than use the docker hub
registry container, we can have finer grained control if we clone and build
the docker-distribution repository directly.
Since this is distinct from the main docker package/codebase, we break the
registry back out into its own package.
We also create a baseline configuration and .service file that can be the
basis for more complex implementations.
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
3 files changed, 77 insertions, 10 deletions
diff --git a/recipes-containers/docker-distribution/docker-distribution_git.bb b/recipes-containers/docker-distribution/docker-distribution_git.bb new file mode 100644 index 00000000..e86d4ff9 --- /dev/null +++ b/recipes-containers/docker-distribution/docker-distribution_git.bb | |||
@@ -0,0 +1,65 @@ | |||
1 | HOMEPAGE = "http://github.com/docker/distribution" | ||
2 | SUMMARY = "The Docker toolset to pack, ship, store, and deliver content" | ||
3 | LICENSE = "Apache-2.0" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=d2794c0df5b907fdace235a619d80314" | ||
5 | |||
6 | DEPENDS = "go-cross-${TARGET_ARCH} \ | ||
7 | " | ||
8 | |||
9 | SRCREV_distribution="0810eba2adf048b77621472991211924d9ec31c5" | ||
10 | SRC_URI = "git://github.com/docker/distribution.git;branch=master;name=distribution;destsuffix=git/src/github.com/docker/distribution \ | ||
11 | file://docker-registry.service \ | ||
12 | " | ||
13 | |||
14 | PACKAGES =+ "docker-registry" | ||
15 | |||
16 | PV = "v2.6.0-rc+git${SRCPV}" | ||
17 | S = "${WORKDIR}/git/src/github.com/docker/distribution" | ||
18 | |||
19 | inherit go-osarchmap | ||
20 | |||
21 | # This disables seccomp and apparmor, which are on by default in the | ||
22 | # go package. | ||
23 | EXTRA_OEMAKE="BUILDTAGS=''" | ||
24 | |||
25 | do_compile() { | ||
26 | export GOARCH="${TARGET_GOARCH}" | ||
27 | export GOPATH="${WORKDIR}/git/" | ||
28 | |||
29 | # Pass the needed cflags/ldflags so that cgo | ||
30 | # can find the needed headers files and libraries | ||
31 | export CGO_ENABLED="1" | ||
32 | export CFLAGS="" | ||
33 | export LDFLAGS="" | ||
34 | export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
35 | export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
36 | |||
37 | oe_runmake binaries | ||
38 | } | ||
39 | |||
40 | do_install() { | ||
41 | install -d ${D}/${sbindir} | ||
42 | install ${S}/bin/registry ${D}/${sbindir} | ||
43 | |||
44 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
45 | install -d ${D}${systemd_unitdir}/system | ||
46 | install -m 644 ${WORKDIR}/docker-registry.service ${D}/${systemd_unitdir}/system | ||
47 | fi | ||
48 | |||
49 | install -d ${D}/${sysconfdir}/docker-distribution/registry/ | ||
50 | install ${S}/cmd/registry/config-example.yml ${D}/${sysconfdir}/docker-distribution/registry/config.yml | ||
51 | |||
52 | # storage for the registry containers | ||
53 | install -d ${D}/${localstatedir}/lib/registry/ | ||
54 | } | ||
55 | |||
56 | INSANE_SKIP_${PN} += "ldflags already-stripped" | ||
57 | INSANE_SKIP_docker-registry += "ldflags already-stripped" | ||
58 | |||
59 | FILES_docker-registry = "${sbindir}/*" | ||
60 | FILES_docker-registry += "${systemd_unitdir}/system/docker-registry.service" | ||
61 | FILES_docker-registry += "${sysconfdir}/docker-distribution/*" | ||
62 | FILES_docker-registry += "${localstatedir}/lib/registry/" | ||
63 | |||
64 | SYSTEMD_SERVICE_docker-registry = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker-registry.service','',d)}" | ||
65 | SYSTEMD_AUTO_ENABLE_docker-registry = "enable" | ||
diff --git a/recipes-containers/docker-distribution/files/docker-registry.service b/recipes-containers/docker-distribution/files/docker-registry.service new file mode 100644 index 00000000..15460c7a --- /dev/null +++ b/recipes-containers/docker-distribution/files/docker-registry.service | |||
@@ -0,0 +1,10 @@ | |||
1 | [Unit] | ||
2 | Description=v2 Registry server for Docker | ||
3 | |||
4 | [Service] | ||
5 | Type=simple | ||
6 | ExecStart=/usr/sbin/registry serve /etc/docker-distribution/registry/config.yml | ||
7 | Restart=on-failure | ||
8 | |||
9 | [Install] | ||
10 | WantedBy=multi-user.target | ||
diff --git a/recipes-containers/docker/docker_git.bb b/recipes-containers/docker/docker_git.bb index bad3d866..246fbfeb 100644 --- a/recipes-containers/docker/docker_git.bb +++ b/recipes-containers/docker/docker_git.bb | |||
@@ -24,7 +24,6 @@ SRC_URI = "\ | |||
24 | git://github.com/docker/docker.git;nobranch=1;name=docker \ | 24 | git://github.com/docker/docker.git;nobranch=1;name=docker \ |
25 | git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \ | 25 | git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \ |
26 | file://docker.init \ | 26 | file://docker.init \ |
27 | file://docker-registry.service \ | ||
28 | file://hi.Dockerfile \ | 27 | file://hi.Dockerfile \ |
29 | file://context-use-golang.org-x-net-pkg-until-we-move-to-go.patch \ | 28 | file://context-use-golang.org-x-net-pkg-until-we-move-to-go.patch \ |
30 | " | 29 | " |
@@ -60,7 +59,7 @@ DEPENDS = " \ | |||
60 | grpc-go \ | 59 | grpc-go \ |
61 | " | 60 | " |
62 | 61 | ||
63 | PACKAGES =+ "${PN}-contrib ${PN}-registry" | 62 | PACKAGES =+ "${PN}-contrib" |
64 | 63 | ||
65 | DEPENDS_append_class-target = "lvm2" | 64 | DEPENDS_append_class-target = "lvm2" |
66 | RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ | 65 | RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ |
@@ -69,7 +68,7 @@ RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ | |||
69 | RDEPENDS_${PN} += "virtual/containerd virtual/runc" | 68 | RDEPENDS_${PN} += "virtual/containerd virtual/runc" |
70 | 69 | ||
71 | RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" | 70 | RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" |
72 | RSUGGESTS_${PN} = "lxc docker-registry rt-tests" | 71 | RSUGGESTS_${PN} = "lxc rt-tests" |
73 | DOCKER_PKG="github.com/docker/docker" | 72 | DOCKER_PKG="github.com/docker/docker" |
74 | 73 | ||
75 | do_configure[noexec] = "1" | 74 | do_configure[noexec] = "1" |
@@ -136,9 +135,7 @@ inherit systemd update-rc.d | |||
136 | 135 | ||
137 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" | 136 | SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" |
138 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}" | 137 | SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}" |
139 | SYSTEMD_SERVICE_${PN}-registry = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker-registry.service','',d)}" | ||
140 | 138 | ||
141 | SYSTEMD_AUTO_ENABLE_${PN}-registry = "enable" | ||
142 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" | 139 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" |
143 | 140 | ||
144 | INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" | 141 | INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" |
@@ -156,8 +153,6 @@ do_install() { | |||
156 | install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system | 153 | install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system |
157 | # replaces one copied from above with one that uses the local registry for a mirror | 154 | # replaces one copied from above with one that uses the local registry for a mirror |
158 | install -m 644 ${S}/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system | 155 | install -m 644 ${S}/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system |
159 | |||
160 | install -m 644 ${WORKDIR}/docker-registry.service ${D}/${systemd_unitdir}/system | ||
161 | else | 156 | else |
162 | install -d ${D}${sysconfdir}/init.d | 157 | install -d ${D}${sysconfdir}/init.d |
163 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init | 158 | install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init |
@@ -172,9 +167,6 @@ inherit useradd | |||
172 | USERADD_PACKAGES = "${PN}" | 167 | USERADD_PACKAGES = "${PN}" |
173 | GROUPADD_PARAM_${PN} = "-r docker" | 168 | GROUPADD_PARAM_${PN} = "-r docker" |
174 | 169 | ||
175 | FILES_${PN}-registry += "${systemd_unitdir}/system/docker-registry.service" | ||
176 | RDEPENDS_${PN}-registry += "docker" | ||
177 | |||
178 | FILES_${PN} += "${systemd_unitdir}/system/*" | 170 | FILES_${PN} += "${systemd_unitdir}/system/*" |
179 | 171 | ||
180 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" | 172 | FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" |