From aa1eaeaddd25642ea620f734aca4fb6e9c93eaa0 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 25 Apr 2016 00:45:24 -0700 Subject: app-emulation/docker-registry: new package Package-Manager: portage-2.2.28 --- app-emulation/docker-registry/Manifest | 1 + .../docker-registry/docker-registry-2.4.0.ebuild | 52 ++++++++++++++++++++++ app-emulation/docker-registry/files/config.yml | 18 ++++++++ app-emulation/docker-registry/files/registry.confd | 2 + app-emulation/docker-registry/files/registry.initd | 25 +++++++++++ .../docker-registry/files/registry.logrotated | 7 +++ .../docker-registry/files/registry.service | 13 ++++++ app-emulation/docker-registry/metadata.xml | 10 +++++ 8 files changed, 128 insertions(+) create mode 100644 app-emulation/docker-registry/Manifest create mode 100644 app-emulation/docker-registry/docker-registry-2.4.0.ebuild create mode 100644 app-emulation/docker-registry/files/config.yml create mode 100644 app-emulation/docker-registry/files/registry.confd create mode 100644 app-emulation/docker-registry/files/registry.initd create mode 100644 app-emulation/docker-registry/files/registry.logrotated create mode 100644 app-emulation/docker-registry/files/registry.service create mode 100644 app-emulation/docker-registry/metadata.xml (limited to 'app-emulation/docker-registry') diff --git a/app-emulation/docker-registry/Manifest b/app-emulation/docker-registry/Manifest new file mode 100644 index 000000000000..9607b5c0abd3 --- /dev/null +++ b/app-emulation/docker-registry/Manifest @@ -0,0 +1 @@ +DIST docker-registry-2.4.0.tar.gz 1294478 SHA256 cfd0c6212a05c047fa6a5b9093493d2de0b438936f2d7318a902263a4a3d7b0f SHA512 668ba35adbe897f73e93e3ec8766123a70b4d2b0d57d4ec3e9f77f6d60d381184acc331b04ab0391f4c648da223dd2338a4065027e6c63aa86b1f1a039d7e300 WHIRLPOOL b07b0f79b97547c33fa2b64bcf85cc1e2bac3e17c38d6bda18a5ed7cfc500938ee29c26c15fbbc5110b22c2d28764674034cf325519261b01ada71deb6b541be diff --git a/app-emulation/docker-registry/docker-registry-2.4.0.ebuild b/app-emulation/docker-registry/docker-registry-2.4.0.ebuild new file mode 100644 index 000000000000..08c7199e6d66 --- /dev/null +++ b/app-emulation/docker-registry/docker-registry-2.4.0.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +inherit golang-vcs-snapshot systemd user + +KEYWORDS="~amd64" +EGO_PN="github.com/docker/distribution/..." +EGIT_COMMIT="v${PV}" +SRC_URI="https://${EGO_PN%/*}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz" +DESCRIPTION="Docker Registry 2.0" +HOMEPAGE="https://${EGO_PN%/*}" +LICENSE="Apache-2.0" +SLOT="0/${PVR}" +IUSE="" +DEPEND=">=dev-lang/go-1.5" +SVCNAME=registry + +pkg_setup() { + enewgroup ${SVCNAME} + enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME} +} + +src_compile() { + GOPATH="${S}" GO15VENDOREXPERIMENT=1 \ + go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die +} + +src_install() { + golang_install_pkgs + exeinto /usr/libexec/${PN} + doexe "${S}"/bin/* + insinto /etc/docker/registry + newins "${FILESDIR}/config.yml" config.yml.example + newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}" + newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}" + systemd_dounit "${FILESDIR}/${SVCNAME}.service" + keepdir /var/{lib,log}/${SVCNAME} + fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME} + insinto /etc/logrotate.d + newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}" +} + +golang_install_pkgs() { + insinto $(dirname "${EPREFIX}$(get_golibdir)/src/${EGO_PN%/*}") + rm -rf "${S}"/src/${EGO_PN%/*}/.git* \ + "${S}"/{src,pkg/$(go env GOOS)_$(go env GOARCH)}/${EGO_PN%/*}/vendor + doins -r "${S}"/src/${EGO_PN%/*} + insinto $(dirname "${EPREFIX}$(get_golibdir)/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}") + doins -r "${S}"/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}{,.a} +} diff --git a/app-emulation/docker-registry/files/config.yml b/app-emulation/docker-registry/files/config.yml new file mode 100644 index 000000000000..b5700e1922d2 --- /dev/null +++ b/app-emulation/docker-registry/files/config.yml @@ -0,0 +1,18 @@ +version: 0.1 +log: + fields: + service: registry +storage: + cache: + blobdescriptor: inmemory + filesystem: + rootdirectory: /var/lib/registry +http: + addr: :5000 + headers: + X-Content-Type-Options: [nosniff] +health: + storagedriver: + enabled: true + interval: 10s + threshold: 3 diff --git a/app-emulation/docker-registry/files/registry.confd b/app-emulation/docker-registry/files/registry.confd new file mode 100644 index 000000000000..bfa97f127ef1 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.confd @@ -0,0 +1,2 @@ +# arguments for docker-registry +command_args="serve /etc/docker/registry/config.yml" diff --git a/app-emulation/docker-registry/files/registry.initd b/app-emulation/docker-registry/files/registry.initd new file mode 100644 index 000000000000..4df83f31fcbb --- /dev/null +++ b/app-emulation/docker-registry/files/registry.initd @@ -0,0 +1,25 @@ +#!/sbin/openrc-run +# Copyright 2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="Docker Registry 2.0" +pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"} +user=${SVCNAME} +group=${SVCNAME} + +command="/usr/libexec/docker-${SVCNAME}/${SVCNAME}" +command_args="${command_args:-serve /etc/docker/registry/config.yml}" +command_background="true" +start_stop_daemon_args="--user ${user} --group ${group} \ + --stdout /var/log/${SVCNAME}/${SVCNAME}.log \ + --stderr /var/log/${SVCNAME}/${SVCNAME}.log" + +depend() { + need net + after net +} + +start_pre() { + checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}" +} diff --git a/app-emulation/docker-registry/files/registry.logrotated b/app-emulation/docker-registry/files/registry.logrotated new file mode 100644 index 000000000000..7f89ba20bcf5 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.logrotated @@ -0,0 +1,7 @@ +/var/log/registry/registry.log { + su registry registry + missingok + size 5M + rotate 3 + compress +} diff --git a/app-emulation/docker-registry/files/registry.service b/app-emulation/docker-registry/files/registry.service new file mode 100644 index 000000000000..14ff5f9c0b77 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.service @@ -0,0 +1,13 @@ +[Unit] +Description=Docker Registry 2.0 +Requires=network-online.target +After=network-online.target + +[Service] +User=registry +PrivateDevices=Yes +Environment="DOCKER_REGISTRY_ARGS=serve /etc/docker/registry/config.yml" +ExecStart=/usr/libexec/docker-registry/registry $DOCKER_REGISTRY_ARGS + +[Install] +WantedBy=multi-user.target diff --git a/app-emulation/docker-registry/metadata.xml b/app-emulation/docker-registry/metadata.xml new file mode 100644 index 000000000000..4f66ba32a890 --- /dev/null +++ b/app-emulation/docker-registry/metadata.xml @@ -0,0 +1,10 @@ + + + + + zmedico@gentoo.org + + + docker/distribution + + -- cgit v1.2.3-65-gdbad