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 /recipes-containers/docker-distribution | |
| 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>
Diffstat (limited to 'recipes-containers/docker-distribution')
| -rw-r--r-- | recipes-containers/docker-distribution/docker-distribution_git.bb | 65 | ||||
| -rw-r--r-- | recipes-containers/docker-distribution/files/docker-registry.service | 10 |
2 files changed, 75 insertions, 0 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 | ||
