summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2017-03-11 23:37:36 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-03-12 00:32:33 -0500
commit5c501c8ec8812fbf8027bc9f46ed635ff15d96e6 (patch)
tree7679281e5b6c6cdf6625d7fd7385b740737a9730
parentc5cd21af5f27309c7926b781852e1ef22940a10d (diff)
downloadmeta-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>
-rw-r--r--recipes-containers/docker-distribution/docker-distribution_git.bb65
-rw-r--r--recipes-containers/docker-distribution/files/docker-registry.service10
-rw-r--r--recipes-containers/docker/docker_git.bb12
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 @@
1HOMEPAGE = "http://github.com/docker/distribution"
2SUMMARY = "The Docker toolset to pack, ship, store, and deliver content"
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=d2794c0df5b907fdace235a619d80314"
5
6DEPENDS = "go-cross-${TARGET_ARCH} \
7 "
8
9SRCREV_distribution="0810eba2adf048b77621472991211924d9ec31c5"
10SRC_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
14PACKAGES =+ "docker-registry"
15
16PV = "v2.6.0-rc+git${SRCPV}"
17S = "${WORKDIR}/git/src/github.com/docker/distribution"
18
19inherit go-osarchmap
20
21# This disables seccomp and apparmor, which are on by default in the
22# go package.
23EXTRA_OEMAKE="BUILDTAGS=''"
24
25do_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
40do_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
56INSANE_SKIP_${PN} += "ldflags already-stripped"
57INSANE_SKIP_docker-registry += "ldflags already-stripped"
58
59FILES_docker-registry = "${sbindir}/*"
60FILES_docker-registry += "${systemd_unitdir}/system/docker-registry.service"
61FILES_docker-registry += "${sysconfdir}/docker-distribution/*"
62FILES_docker-registry += "${localstatedir}/lib/registry/"
63
64SYSTEMD_SERVICE_docker-registry = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker-registry.service','',d)}"
65SYSTEMD_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]
2Description=v2 Registry server for Docker
3
4[Service]
5Type=simple
6ExecStart=/usr/sbin/registry serve /etc/docker-distribution/registry/config.yml
7Restart=on-failure
8
9[Install]
10WantedBy=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
63PACKAGES =+ "${PN}-contrib ${PN}-registry" 62PACKAGES =+ "${PN}-contrib"
64 63
65DEPENDS_append_class-target = "lvm2" 64DEPENDS_append_class-target = "lvm2"
66RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \ 65RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \
@@ -69,7 +68,7 @@ RDEPENDS_${PN} = "curl aufs-util git util-linux iptables \
69RDEPENDS_${PN} += "virtual/containerd virtual/runc" 68RDEPENDS_${PN} += "virtual/containerd virtual/runc"
70 69
71RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat" 70RRECOMMENDS_${PN} = "kernel-module-dm-thin-pool kernel-module-nf-nat"
72RSUGGESTS_${PN} = "lxc docker-registry rt-tests" 71RSUGGESTS_${PN} = "lxc rt-tests"
73DOCKER_PKG="github.com/docker/docker" 72DOCKER_PKG="github.com/docker/docker"
74 73
75do_configure[noexec] = "1" 74do_configure[noexec] = "1"
@@ -136,9 +135,7 @@ inherit systemd update-rc.d
136 135
137SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" 136SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
138SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}" 137SYSTEMD_SERVICE_${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker.service','',d)}"
139SYSTEMD_SERVICE_${PN}-registry = "${@bb.utils.contains('DISTRO_FEATURES','systemd','docker-registry.service','',d)}"
140 138
141SYSTEMD_AUTO_ENABLE_${PN}-registry = "enable"
142SYSTEMD_AUTO_ENABLE_${PN} = "enable" 139SYSTEMD_AUTO_ENABLE_${PN} = "enable"
143 140
144INITSCRIPT_PACKAGES += "${@bb.utils.contains('DISTRO_FEATURES','sysvinit','${PN}','',d)}" 141INITSCRIPT_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
172USERADD_PACKAGES = "${PN}" 167USERADD_PACKAGES = "${PN}"
173GROUPADD_PARAM_${PN} = "-r docker" 168GROUPADD_PARAM_${PN} = "-r docker"
174 169
175FILES_${PN}-registry += "${systemd_unitdir}/system/docker-registry.service"
176RDEPENDS_${PN}-registry += "docker"
177
178FILES_${PN} += "${systemd_unitdir}/system/*" 170FILES_${PN} += "${systemd_unitdir}/system/*"
179 171
180FILES_${PN}-contrib += "${datadir}/docker/check-config.sh" 172FILES_${PN}-contrib += "${datadir}/docker/check-config.sh"